Firefox 76.0 javascript window.open() parameters ignored, tool bar, etc. missing
Until several weeks ago, new windows created through Javascript with window.open() worked. We could pass the new size, and other features, e.g. menubar, toolbar, etc. and they would show up. As of v.76.0 this is no longer true. The parameters are ignored. If we use no parameters, the menubar, etc. do show, but we can't control any new window features. We have not changed our programs at all, and window.open() parameters still work correctly in Chrome, Brave, Edge, etc. How do we get Firefox to recognize the window.open() parameters (again)?
Wybrane rozwiązanie
I can only imagine the developers wanted Firefox to work the same as other browsers when it comes to what is displayed in popup windows.
The context menu also has has Back, Forward, and Reload buttons if you right click a blank area of the page.
The old trick to show the full toolbar and tabs bar (dom.disable_window_open_feature.toolbar => true) no longer has any effect in Firefox 76 and I don't think there was any other preference for it.
userChrome.css Option
If you control the computers where you have this issue, you do have the option to "hack" the user interface using custom style rules in a userChrome.css files. This would allow showing the tabs bar and missing toolbar controls. However, this would take some time to deploy because a new folder needs to be created in the active profile for each Firefox installation and the new file dropped in.
WARNING: This script is not provided by Mozilla and is not officially supported Creating a userChrome.css file and other ways of customizing Firefox that are not exposed in the interface are there for developers, not end-users. If it were intended for end-users, you would see a menu option or checkbox; you wouldn't have to hack a text file in a hidden location.
What this means is that even though the functionality you want is no longer supported, a third-party has found a way to do it using the CSS file. If it breaks in new versions, you will need to contact the person who provided the script.
[Warning added by moderator.]
If you haven't created an optional userChrome.css file before, it is a little bit of a project, so wait until you have 10 quiet minutes so you can take your time.
(For anyone who already has a userChrome.css file set up, you just need to add the rules under (A) to your file.)
(A) Select and copy the following style rule code
/*** Popup window mods for Firefox 76 ***/ /* Override hiding of tab bar */ *|*:root[chromehidden~="toolbar"] #TabsToolbar[collapsed="true"] { visibility: visible !important;; } /* Override hiding of "additional" toolbar controls */ *|*:root[chromehidden~="toolbar"] .chromeclass-toolbar-additional { display: -moz-box !important; }
(B) Generate and download a userChrome.css
file
Open the following page and paste the above rules into the editor, replacing the sample rule:
https://www.userchrome.org/download-userchrome-css.html
Then click "Generate CSS File" and save the userChrome.css file to your computer. (See first attached screenshot)
Use the downloads list on the toolbar to open the downloads folder directly to the new userChrome.css file. (See second attached screenshot)
Minimize that file browser window for later reference.
(C) Create a new chrome
folder in your profile folder
The following article has the detailed steps for that (#1, #2, and I recommend #3)
https://www.userchrome.org/how-create-userchrome-css.html
I have videos for both Windows and Mac in case the text is not clear.
(D) Move the userChrome.css
file you downloaded in Step B into the chrome
folder you created in Step C
(E) Set Firefox to look for userChrome.css at startup -- see step #6 in the above article.
The next time you exit Firefox and start it up again, it should discover that file and apply the rules.
Success? (You can test using the third link on https://www.jeffersonscher.com/res/popit.html )
Przeczytaj tę odpowiedź w całym kontekście 👍 0Wszystkie odpowiedzi (6)
Yes, Firefox 76 has changed how it responds to "features" specified in window.open() and now ignores some of them:
https://developer.mozilla.org/en-US/docs/Web/API/Window/open#Toolbar_and_UI_parts_features
What features does your window.open() call specify?
This is a typical function:
function showhistory(itemid) {
w = 820; h = 500; myname = "ItemHistoryWindowFromPO"; mypage = "admin.php?buttonpress=show_inventory_history_" + itemid; var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops = "height="+h+",width="+w+",top="+wint+",left="+winl+",scrollbars=yes,resizable=yes,status=yes,menubar=yes,location=yes,toolbar=yes";
win = window.open(mypage, myname, winprops); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } return; }
These should still work:
"height="+h+",width="+w+",top="+wint+",left="+winl+"
These are ignored:
scrollbars=yes,resizable=yes,status=yes,menubar=yes,location=yes,toolbar=yes
The automatically applied values appear to be:
scrollbars=yes,resizable=yes,status=yes,menubar=no,location=yes,toolbar=no
jjacobs3 said
... window.open() parameters still work correctly in Chrome, Brave, Edge, etc.
I don't think any of those browsers have a top menu bar like Firefox. Chrome 81-83 doesn't show a full toolbar if I set toolbar=yes, although perhaps I am missing a configurable setting (I hardly use Chrome). Classic Edge doesn't show the toolbar either; I haven't tried Chromium Edge.
The refresh (circle with an arrow), "back or forward" (triangle) button is missing and because the top of the tab is not there, right clicking does not get the "duplicate tab" menu selection.
If I'm understanding you correctly, there is no means of recovering our former method of operation. No setting(s) in "about:config". Nothing.
Unless there is reason to remove something on account of potentially bad behavior by some, I don't understand removing functionality which is guaranteed to break some websites. Do you know why these were removed?
We mostly use Firefox because it alone among the browsers still allows us to call the Windows printer dialog and to set very narrow page margins, etc. This is critical for using non-standard printers, e.g. label, receipt, etc. Microsoft, whose own browser doesn't even work for this purpose, seems to think all printers in the world print only 8.5"x11" sheets. Using Firefox, we are able to print long receipts only a few inches wide.
It is very troubling to think that one day, Firefox might decide to arbitrarily do away with our printer abilities (as apparently has happened with the window.open parameters) and then we will be left without a single browser that still works for our purpose (which is running grocery store checkout POS terminals via a webpage).
For the time being, a good deal of functionality can be restored through keystrokes (e.g. "backspace" for the back button, and F5 refresh, etc.), but we're not used to them. It would be much better if there was a setting in "about:config" which allowed us to turn the lost functionality "on" again.
Wybrane rozwiązanie
I can only imagine the developers wanted Firefox to work the same as other browsers when it comes to what is displayed in popup windows.
The context menu also has has Back, Forward, and Reload buttons if you right click a blank area of the page.
The old trick to show the full toolbar and tabs bar (dom.disable_window_open_feature.toolbar => true) no longer has any effect in Firefox 76 and I don't think there was any other preference for it.
userChrome.css Option
If you control the computers where you have this issue, you do have the option to "hack" the user interface using custom style rules in a userChrome.css files. This would allow showing the tabs bar and missing toolbar controls. However, this would take some time to deploy because a new folder needs to be created in the active profile for each Firefox installation and the new file dropped in.
WARNING: This script is not provided by Mozilla and is not officially supported Creating a userChrome.css file and other ways of customizing Firefox that are not exposed in the interface are there for developers, not end-users. If it were intended for end-users, you would see a menu option or checkbox; you wouldn't have to hack a text file in a hidden location.
What this means is that even though the functionality you want is no longer supported, a third-party has found a way to do it using the CSS file. If it breaks in new versions, you will need to contact the person who provided the script.
[Warning added by moderator.]
If you haven't created an optional userChrome.css file before, it is a little bit of a project, so wait until you have 10 quiet minutes so you can take your time.
(For anyone who already has a userChrome.css file set up, you just need to add the rules under (A) to your file.)
(A) Select and copy the following style rule code
/*** Popup window mods for Firefox 76 ***/ /* Override hiding of tab bar */ *|*:root[chromehidden~="toolbar"] #TabsToolbar[collapsed="true"] { visibility: visible !important;; } /* Override hiding of "additional" toolbar controls */ *|*:root[chromehidden~="toolbar"] .chromeclass-toolbar-additional { display: -moz-box !important; }
(B) Generate and download a userChrome.css
file
Open the following page and paste the above rules into the editor, replacing the sample rule:
https://www.userchrome.org/download-userchrome-css.html
Then click "Generate CSS File" and save the userChrome.css file to your computer. (See first attached screenshot)
Use the downloads list on the toolbar to open the downloads folder directly to the new userChrome.css file. (See second attached screenshot)
Minimize that file browser window for later reference.
(C) Create a new chrome
folder in your profile folder
The following article has the detailed steps for that (#1, #2, and I recommend #3)
https://www.userchrome.org/how-create-userchrome-css.html
I have videos for both Windows and Mac in case the text is not clear.
(D) Move the userChrome.css
file you downloaded in Step B into the chrome
folder you created in Step C
(E) Set Firefox to look for userChrome.css at startup -- see step #6 in the above article.
The next time you exit Firefox and start it up again, it should discover that file and apply the rules.
Success? (You can test using the third link on https://www.jeffersonscher.com/res/popit.html )
Zmodyfikowany przez Chris Ilias w dniu
This is wonderful, and I will implement it, though, as you point out, it will take some time. I am completely unfamiliar with userChrome.css and now can't help but wonder what else it can do. Investigation will be the order of the day.
However, I still feel it would have been far easier (and better) if the Firefox development team had merely used the "about:config" settings and provided an option that allowed users who have control of their own computer/browser (which we do) to set the JavaScript window.open pop-up window behavior to the old style (which has worked for many years). After all, the "duplicate tab" menu option (one of the best enhancements ever in our opinion) still works, so the former functionality must still be there somewhere.
Many thanks for your very detailed instructions. I hope others will profit from this as much as we will.