window.open using _blank open in same window
It seems in the latest update when using window.open(url,'_blank') in place of opening the link in a new window/tab, it is opening it in the current tab
Solução escolhida
We have found a fix to this...
var parentOpener = window.opener; window.opener = null; window.open(url,"_blank"); window.opener = parentOpener;
Ler esta resposta no contexto 👍 0Todas as respostas (7)
Could you please expand on your issue. If possible in point form so that we may help solve your issue.
What is page suppose to open to when start Firefox and is it doing what it you want ? What happens when open a new Tab ? Did you insert the old fix code into about:config ?
So sorta need more information if you would please
A simple bit of java script that has worked for the last 10 years stopped working correctly on the latest Firefox update. The simple use of window.open( URL , "_blank") which will open the link in another tab, has stopped opening another tab and now open the link in the same window as the java script is running in.
Might point out the link dose not return a HTML page, it returns a excel spread sheet.. We send a Json object to the server, it makes a excel spread sheet, and returns a link for the spread sheet, we use the link in window.open to download the spread sheet. In the past it use to open another tab and download the spread sheet it now opens that link in the current tab and not a new one.
cmd1234 said
Might point out the link dose not return a HTML page, it returns a excel spread sheet..
So does window.open(URL, "_blank") work normally for HTML pages, and is broken only for downloads (content Firefox can't display in a tab or which has file-disposition:attachment)?
Test page for HTML: https://jeffersonscher.com/res/popit.html
For downloads: in the old days, you'd get a blank new tab and then Firefox would realize it's a download and close the blank tab. But in Firefox 54 instead of opening and closing a blank tab, do you find that Firefox closes the page you were on?
This thread has that scenario with a possible (client-side) workaround: opening a PDF document closes underyling window (workaround is to disable multiprocess)
Note: I have multiprocess disabled due to one or more of my extensions being incompatible, so I haven't been experiencing this myself.
You can check some prefs on the about:config page if you haven't done this yet.
- http://kb.mozillazine.org/browser.link.open_newwindow
- 1: current tab; 2:new window; 3:new tab;
For links opened via JavaScript you can look at this pref:
You can use the button on the "Help -> Troubleshooting Information" (about:support) page to go to the current Firefox profile folder or use the about:profiles page.
- Help -> Troubleshooting Information -> Profile Directory:
Windows: Show Folder; Linux: Open Directory; Mac: Show in Finder - http://kb.mozillazine.org/Profile_folder_-_Firefox
jscher2000 said
cmd1234 saidMight point out the link dose not return a HTML page, it returns a excel spread sheet..So does window.open(URL, "_blank") work normally for HTML pages, and is broken only for downloads (content Firefox can't display in a tab or which has file-disposition:attachment)?
Test page for HTML: https://jeffersonscher.com/res/popit.html
For downloads: in the old days, you'd get a blank new tab and then Firefox would realize it's a download and close the blank tab. But in Firefox 54 instead of opening and closing a blank tab, do you find that Firefox closes the page you were on?
This thread has that scenario with a possible (client-side) workaround: opening a PDF document closes underyling window (workaround is to disable multiprocess)
Note: I have multiprocess disabled due to one or more of my extensions being incompatible, so I haven't been experiencing this myself.
opening a normal html page dose work ok. my settings for dom.ipc.processCount was already set too 1 and setting browser.tabs.remote.autostart.2 to false did fix the problem, but we can not tell all our clients to go into about:config and change there browser setting if we are going to tell our client anything it will be go and use chrome in place of firefox, as chrome and safari still work ok.
Solução escolhida
We have found a fix to this...
var parentOpener = window.opener; window.opener = null; window.open(url,"_blank"); window.opener = parentOpener;