Document.title ie8 problems

Why IE8 cannot change the title of the document with document.title = "test title";

+3
source share
3 answers

After working on IE8 for me. But I got an ActiveX pop-up window, so maybe your IE8 will not ask for these problems and just refuse to write scripts.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<script type="text/javascript">
    function changeTitle() {
        document.title = 'Foobar';
    }
</script>
</head>
<body onload="changeTitle()">
</body>
</html>
+2
source

Really? Use document.title = 'Foo Bar';has always worked for me. Is your script running?

Try to do this right before document.title = ...:

alert('I work.');

If you do not receive a warning window, your script does not work.

+1
source

: http://support.microsoft.com/kb/296113

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JAVASCRIPT">

function runTest()
{
    var s ="We should set this as the new title" 
    var mytitle = document.createElement("TITLE");
    mytitle.innerHTML = s;
    alert(s);       
    document.documentElement.childNodes[0].appendChild(mytitle);

}
function fix()
{
    var s = "Now we change the title";
    alert(s);
    document.title = s; 
}
</SCRIPT>
</HEAD>
<BODY>
<input type="button" value="Problem" onclick="runTest()"/>
<input type="button" value="Workaround" onclick="fix()"/>
</BODY>

IE 9,8,7

, , -, .

document.title !

0

All Articles