[thelist] Popup window and Safari

James Hardy evolt at weeb.biz
Wed Jan 19 10:42:55 CST 2005


And lo; it came to pass that the great prophet, Joshua Olson spake. And 
the huddled masses rejoiced to hear:

> 
> My best guess is that the initial window.open('#'...) is prompting Safari to
> change pages even after it clearly displays the content as directed in the
> next few lines.  Can anybody shed light on how to avoid this?
> 
the problem is the #
what # effectively means is the top of the current page. So I imagine 
what is happening is that it opens the window and starts loading the 
current page in order to position itself at the top of it. Before it 
loads, It then executes the code and writes what you want to be written. 
However AFTER it does this, Safari downloads the page and overwrites 
what you have just written.

I can see two possible solutions

One is to add a hack to make the page delay execution of the write.

The second (and better solution) would be to remove the # and just pass 
an empty string - according to my O'Reilly JavaScript: The Definitive 
Guide, the url is "An optional string .. if this argument is omitted, or 
if the empty string is specified, the new window does not display a 
document". I haven't tested it however so could be cloud cuckoo land, 
but it SHOULD work, as it will not attempt to load anything.

James


More information about the thelist mailing list