Forum Moderators: open

Message Too Old, No Replies

window.open strange behavior on firefox

         

kristof_v

2:36 pm on Nov 6, 2008 (gmt 0)

10+ Year Member



Hi,

I'm have a few links that should all open in the same window or tab.
To accomplish this I've given the window a name like in this example code:


<a href="#" onClick='window.open("http://somesite.com", "mywindow", "");'>link 1</a>
<a href="#" onClick='window.open("http://someothersite.com", "mywindow", "");'>link 2</a>

This works OK in internet explorer, but firefox always opens a new tab/window.
Any ideas?

Thanks

Fotiman

2:46 pm on Nov 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In Firefox, go to Tools > Options > Tabs. Do you have it set to open new pages in a new Tab?

kristof_v

2:53 pm on Nov 6, 2008 (gmt 0)

10+ Year Member



yes the options are:

New pages should be opened in

1) a new window
2) a new tab

but the options are radio buttons, so either one needs to be selected.
The behavior is the same in both scenarios however, a new tab/window is always opened, evn though the window.open name attribute is set to the same shared name.

astupidname

12:33 am on Nov 7, 2008 (gmt 0)

10+ Year Member



This works OK in internet explorer, but firefox always opens a new tab

Firefox will always open the new window in new tab, unless the width or height is defined for the new window. So you should just need to add a width= or height= or both, for example:
<a href="#" onClick='window.open("http://www.google.com", "mywindow", "width=700, height=600");'>link 1</a>