onClick events to open window opens all windows in same small size
This simple script snippet has always worked in the past, and it even works correctly in IE. But in Firefox it opens a new window at about 400 x 400 pixels.
<a href="javascript: void(0)" onclick="window.open('January.shtml','windowname1','width=850, height=600');
return false;">Click here for simple popup window</a>
What needs to be changes in the FF configuration so it works correctly?
Failure to get this to work correctly means I will have to discontinue supporting Firefox and go to Internet Explorer where the script works.
Thanks for any support you can provide.
I have already tried some hints in the support page, but no luck with the the suggestions for "link.o"
選ばれた解決策
Hi Armadilloweb, to restore the default value, right-click the preference and choose Reset.
The values in the page are computed using JavaScript. It's a little confusing because when Firefox reports 100% on the menu (the graphical menu displayed by click the "3-bar" menu button on the toolbar), unless I have changed the default behavior, this is relative to the system-level "text size" setting. For example, my Windows setting is 125% so when I have zoom set to 100% on a page, the window.devicePixelRatio shows 1.25 instead of 1.
この回答をすべて読む 👍 0すべての返信 (12)
Are you re-using windowname1 that is still open, or are you closing windowname1 and then launching a fresh instance of the page?
What if you target _blank (example: https://jeffersonscher.com/res/popit.html -- third link)?
jscher2000 said
Are you re-using windowname1 that is still open, or are you closing windowname1 and then launching a fresh instance of the page? What if you target _blank (example: https://jeffersonscher.com/res/popit.html -- third link)?
No, I am simply trying to get a single link to open in one sized window.
I tried your link to several samples and the bottom one provided a small window the same as when I use the single onClick. This is one single instance of opening one html document.
Hmm, I noticed something strange. When I have zoom set to 100% and use the third link, the new window is oversized and pastes into Paint at
1014px x 854px
If I reduce the zoom to 50% and then use the third link, the new window is much smaller, and pastes into Paint at
514px x 479px
I can come closes to the specified 800px x 600px if I set the zoom to 80%, which makes sense because my Windows text size is 125% -- 80% x 125% is close to exactly 96 pixels per inch.
So you may be getting a smaller window if the page you are launching the link from is at less than 100% zoom.
Here is the specific code snippet again. <a href="javascript: void(0)" onclick="window.open('January.shtml','windowname1','width=850, height=600');
return false;">Click here for simple popup window</a>
The new window opens in the top left corner and is sized 608px x 480px. The window can be dragged larger by the corner handles, but will not auto open to 800 x 600 pixels.
The code snippet has no additional controls (attributes) to set any other tools or controls. In other words, there are no Firefox menus to set zoom, the only tool menus appear on the page where the open window snippet lives.
The mouse wheel has no effect on the new window.
Note: I have tried opening FF in "Safe Mode": with all add-ons disabled, no change.
Yes, this is not an issue with your script, it seems to be an issue about how Firefox interprets the dimensions in the script. At least in my test, Firefox seems to adjust the size of the popup window based on the current zoom level of the page that contains the script. To test that for yourself, you can adjust the zoom level of the page using either of these methods:
- menu: look for the row with - | 100% | +
- keyboard: hold down Ctrl and tap + to enlarge, - to reduce, and 0 (zero) to reset to 100%
In this context, 100% means 100% of your Firefox default zoom level, which on newer systems often is actually 125% compared with older systems with lower resolution screens.
I tried to add some code for this in the popit page but sometimes the popup window does not reflect the correct site-specific zoom level until you reload it (Ctrl+r). Hmm...
Okay, I tried again to resolve this problem with another test html document, no go. The window opens to the same old size, but using the CTRL + keys only magnifies the contents of the popup window. It does nothing for the sizing of the window. Even CTRL + R results in the same behavior.
Thanks for trying,
Michael
What is the zoom level BEFORE you click the link/button that pops the new window? That is the variable I'm seeing.
You can experiment with the revised popit page. After the popup opens, use Ctrl+r to make sure it shows the correct initial zoom level and size:
jscher2000 said
What is the zoom level BEFORE you click the link/button that pops the new window? That is the variable I'm seeing. You can experiment with the revised popit page. After the popup opens, use Ctrl+r to make sure it shows the correct initial zoom level and size: https://jeffersonscher.com/res/popit.html
I tried the config. modifications found in your link, now the popup window opens at 100% of the opened window. I tried changing the height and width attributes, but no change.
Sorry, no, that preference change at the bottom is for people who do NOT want a popup window; that part was not for you. Please undo that change.
Then take a look at the center section of the page regarding the resolution. What do you see there regarding the current zoom level and projected window size? Does that work for you the way it works for me (give or take a few pixels)?
I've attached a couple screen shots illustrating the experiment.
jscher2000 said
Sorry, no, that preference change at the bottom is for people who do NOT want a popup window; that part was not for you. Please undo that change. Then take a look at the center section of the page regarding the resolution. What do you see there regarding the current zoom level and projected window size? Does that work for you the way it works for me (give or take a few pixels)? I've attached a couple screen shots illustrating the experiment.
Oh crap!
Now I need to go back and change those preferences. Can you provide me with the correct values for the preferences to get the open window?
For the current Zoom Level, I have no idea where you are getting these values. The only reference to zoom levels I have is in the "View" tool in the top ribbon. Those only have a + or _, just like the CTRL + keys.
選ばれた解決策
Hi Armadilloweb, to restore the default value, right-click the preference and choose Reset.
The values in the page are computed using JavaScript. It's a little confusing because when Firefox reports 100% on the menu (the graphical menu displayed by click the "3-bar" menu button on the toolbar), unless I have changed the default behavior, this is relative to the system-level "text size" setting. For example, my Windows setting is 125% so when I have zoom set to 100% on a page, the window.devicePixelRatio shows 1.25 instead of 1.
The problem has been resolved.
I re-set Firefox to its default settings and lost a theme. It seems the Walnut2 Theme for Firefox was causing the problem. Using the Classic Theme the new window opens correctly with the correct dimensions in the script attributes.
The "proof in the pudding", came when all add=ons were disabled and the popup worked perfectly, then adding in the Walnut theme caused the problem to re-occur.
Thank you very much for working on this problem with me, it allowed me to explore other avenues within Firefox. (Firefox' own popup perfermed perfectly).
Michael G