简体   繁体   中英

Opening URL in New Tab doesn't work in existing, programmatically-opened New Window (Firefox)

I am building a web app, for myself, to control some servers on my home network, and discovered what I think is very odd behavior in Firefox.

If you open a pop-up, via javascript, in Firefox, is it then impossible to open a new tab, via javascript in that pop-up? If not impossible, how do you do it?

Given a clean, default Firefox 3.6.3 installation...

If I open a page in Firefox and then call

var my_window = window.open('http://www.google.com','_blank','top=10');

A brand new "pop-up" window opens.

However, if instead I call

var my_window = window.open('http://www.google.com');

A get a new tab.

HOWEVER...

If I call the first version

var my_window = window.open('http://www.google.com','_blank','top=10');

And then in the new "pop-up" that opens , I call

var my_window = window.open('http://www.google.com');

It opens a new tab in the original window , not a new tab in the pop-up.

This seems very odd, and not intuitive at all. Why would the call in the pop-up open a tab in the "parent" window?

They are both children of the original document and modal windows generally do not have children. They are the rough equivalent of modal dialogs in the Windows OS. In fact, that is what IE does; it even calls it a modal dialog. I think that what is being described here is a new browser instance and not a window with tabs.

This behavoir is a browser setting, the user desides if he opens a new window or a new tab when he opens a link. You cannot manipulate this.

Only thing you can manipulate is if you open the link in a "blank" screen, current window or certain frame

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM