When you run script inside of a DHTML dialog box that was opened with the Document Object Model (DOM) methods window.showModalDialog() or window.showModelessDialog(), you can alter the value of the document.title property successfully. However, the new title never appears in the title bar of the dialog box.
This problem also occurs if you try to use the document.all collection to set the value of "TITLE".
↑ Back to the top
To work around this problem, you can use Active Server Pages (ASP) script or another application server framework to set the title from the server side. There is no known alternative way to change the title from client-side script.
↑ Back to the top
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
↑ Back to the top
Steps to Reproduce Behavior
- Save the following HTML to a file named TestDialogTitle.htm:
<html>
<HEAD>
<SCRIPT>
function load() {
window.showModalDialog("dialog.htm");
//window.showModelessDialog("dialog.htm");
}
</SCRIPT>
<title>DHTML Dialog Title Bug - Reproduction</title>
</HEAD>
<body onload="load();">
</body>
</html>
- Save the following HTML to a file named Dialog.htm:
<html>
<head>
<SCRIPT>
function load() {
document.title = "Title Set From Script";
}
</SCRIPT>
<title>Title Set in DHTML File</title>
</head>
<body onload="load();">
</body>
</html>
- Run testDialogTitle.htm in Internet Explorer. You will see the DHTML dialog box appear with the title "Title Set in DHTML File," which is not the correct behavior.
- Close the DHTML dialog box and open Dialog.htm in the main browser window. You will see the title set to "Title Set From Script", which is the correct behavior that the DHTML dialog box failed to emulate.
- In TestDialogTitle.htm, comment out the top line of script and uncomment the second line to see the same problem with showModelessDialog().
↑ Back to the top
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
↑ Back to the top