Click to See Complete Forum and Search --> : Open New Window in Netscape


ben456
02-04-2003, 05:39 AM
I've been pulling my hair out all morning and trust me, I don't have much to spare so I'm hoping someone can help!

I've created a site at www.relocationgroupnz.com (http://www.relocationgroupnz.com) that has some links to sponsors sites. I used the Dreamweaver MX built-in behaviour to open these in a new browser window. It works fine in IE but in Netscape (tested with 6.2) it creates the new window UNDER the original window. I've tried using a couple of other scripts and found that although they do pop up on top of the original window, after a few seconds the original window comes back on top! After removing all elements one by one I found that it's the title tag causing this - if there is no title it works fine but if there is anything in the title tag the original window comes back on top after a few seconds!

Is this a bug in Netscape? Does anyone have a solution or any ideas how I can get the new window to open and stay on top?

Thanks in anticipation,
Ben

AdamGundry
02-04-2003, 10:33 AM
Instead of using window.open(), you should use a normal hyperlink with the target set to new, like this:

<a href="http://www.somewhere.com" target="new">Go</a>

This will open a new window, should be cross-browser compatible and does not require javascript.

Adam

ben456
02-04-2003, 11:03 AM
Thanks Adam. When I tried it locally I had the same problem with the new window loading under the original window but it seems OK on the web. Bizarre!

Can you set any parameters with the target command, e.g., window size, scrollbars, etc?

Thanks,
Ben

AdamGundry
02-04-2003, 11:14 AM
No, that's the problem with it - choosing the target only instructs the browser to load the URL in that location, you cannot set the parameters as with a window.open().

You'll have to decide between the compatibility of target="new" and the detailed window control of window.open(). I personally prefer the former, because it does not require javascript (which 1 in 10 users have disabled).

Adam