Sometimes when I display a web page, the title that appears at the top of the browser window is incorrect, but then it automatically changes to the correct title. It seems that the browser does this:
1) Display the title at the top of the browser window as the html file name (in Safari), or the title of the previous web page (in Firefox).
3) Change the title at the top of the browser window to the correct title.
For example, suppose you display this file in Safari on a Mac. The title at the top of the browser window will be the name of the html file for a moment, before the correct title appears.
The delay in displaying the correct title also occurs if the user has to respond to an alert. For example in this web page, you see the file name as the title, until you respond to the alert (using Safari on a Mac):
With Safari, I have this problem with both of the above html files. With Firefox, I have this problem only with the first file (the web page that increments i). With Opera, both html files work ok.
If I refresh the web page, the title is ok - the correct title appears right away. I have this problem only when I display the web page in a new window.
Does anyone have a suggestion for how to make the correct title (either in the <title> tag, or set by "document.title =") appear immediately? Thank you very much.