Closed Bug 287453 Opened 20 years ago Closed 20 years ago

window.open width not respected

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: marian.oancea, Assigned: bugzilla)

References

()

Details

(Keywords: qawanted)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

On any page if you have a window.open js with a given width and height it doesnt
respect the width. The opened page's width is smaller. And this happened only
with the 1.0.2 version.

Reproducible: Always

Steps to Reproduce:
1. open a page with links to a popup (eg: www.shockwave.com)
2. click on the link having a window.open js (eg: a game on shockwave.com)
3. 

Actual Results:  
the new window doesn't have the propper width; it's smaller.

Expected Results:  
display the new window with the width given in the js code.
I went to the provided URL, examine the code, loaded the file
http://images2.shockwave.com/js/playfilm.js
in which we can see these 2 functions used to bring up new/secondary windows:

function launchWindow(contentUrl,winWidth,winHeight,winName)
{
   if (!winName) winName = "asw_d" + (Math.floor(Math.random() * 100000));

   window.open(contentUrl, winName, "width="+winWidth+",height="+winHeight);
}

That means that launchWindow sets the width and height of the inner content of
the window, the dimensions of the browser viewport, not of the whole browser window.

function launchWindowFullscreen(contentUrl,winWidth,winHeight,winName)
{
   if (!winName) winName = "asw_d" + (Math.floor(Math.random() * 100000));
   
   var screenWidth = screen.width-20;
   var screenHeight = screen.height-60;

   var newWin = window.open(contentUrl, winName,
"width="+screenWidth+",height="+screenHeight+ ",resizable=yes");
   
   // Move the window to the upperleft corner of the screen
   newWin.moveTo(0,0);
}

And that launchWindowFullscreen function assumes that the user allows scripts to
move the window which might not be the case.

Marian, can you give specific steps to reproduce (like click a specific, defined
and clearly identified link and identify actual and expected results) or best to
provide a *_reduced_* testcase showing the problem. 
Severity: major → normal
Keywords: qawanted
Marian, you have not replied so I assume the window dimension problem is solved
for you. If the problem still occurs, then reopen the bugfile along with giving
specific steps to reproduce or best with a reduced testcase showing the problem.

Resolving as WORKSFORME
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
This bug is affecting me too. I'm running Windows 2000, Firefox v1.0.6 and this
affects me on every site that uses popups (including the one the original user
posted). Also, the width of the popup seems to be too small by a percentage
(rather than being a constant width that happens to be too small for most
popups). The height is correct. 

I'm new to bugzilla so not entirely sure what to post, but if more details or
screenshots would be useful just tell me and I'll post them.

Thanks
Ok, I made a page, test.html, containing the following:

<html>
<head>
<script language="javascript">
function launchWindow(contentUrl,winWidth,winHeight,winName)
{
   if (!winName) winName = "asw_d" + (Math.floor(Math.random() * 100000));

   window.open(contentUrl, winName, "width="+winWidth+",height="+winHeight);
}
</script>
<body>
<a href="javascript:launchWindow('http://www.bugzilla.org', 1000, 1000,
'test')">Click here</a>
</body>
</html>

When I click the link, the window pops up (see attachment 'Image of a supposed
1000px by 1000px popup window' for image of window). The dimensions of the
window are (according to MSPaint) 835px by 971px, instead of the expected 1000
by 1000. I don't know whether the height is exactly correct, as I don't know how
much of the window you count as the height, but the width is definitely too narrow.

Also, is there something I could do to reopen the bug, or is that up to the
powers-that-be?
Fred, you added 3 comments with several questions but you did not add your
name+email address (in the CC list) to receive answers. I corrected this.

> I'm new to bugzilla so not entirely sure what to post

Then, you should read the bug writing guidelines:

http://www.mozilla.org/quality/bug-writing-guidelines.html

which lists the kind of info and data we look for when filing a bugreport,
investigating a bugreport and when confirming a bugreport.

As you can read in comment #1 of this bugfile, we look for specific info which
can reproduce the problem and then help confirm that there is a real bug.

> <html>
> <head>
> <script language="javascript">
> function launchWindow(contentUrl,winWidth,winHeight,winName)
> {
>    if (!winName) winName = "asw_d" + (Math.floor(Math.random() * 100000));
> 
>    window.open(contentUrl, winName, "width="+winWidth+",height="+winHeight);
> }
> </script>
> <body>
> <a href="javascript:launchWindow('http://www.bugzilla.org', 1000, 1000,
> 'test')">Click here</a>
> </body>
> </html>

1- When we're looking for a reduced testcase, we ask people to attach it in the
bugfile. See the "Create a New Attachment (proposed patch, testcase, etc.)" link
in the form up here. Pasting code is not convenient.
2- Creating a reduced testcase made of entirely valid markup code is also
preferable. Also, using "javascript:" in links is almost always wrong and is
always not recommendable. See the window.open() document for more on this.


> The dimensions of the
> window are (according to MSPaint) 835px by 971px, instead of the expected 1000
> by 1000. 

The 1000 numbers are *requested* dimensions by the script. The user screen might
not be wide enough and/or high enough to render such dimensions. In such cases,
Mozilla always resize accordingly *requested* window dimensions to make the
window entirely visible, viewable on the user's screen. That is also the case
for MSIE 6.

"
Requested position and requested dimension values in the strWindowFeatures list
will not be honored and will be corrected if any of such requested value does
not allow the entire browser window to be rendered within the work area for
applications of the user's operating system. No part of the new window can be
initially positioned offscreen. This is by default in all Mozilla-based browser
releases.

MSIE 6 SP2 has a similar error correction mechanism
(http://msdn.microsoft.com/security/productinfo/xpsp2/default.aspx?pull=/library/en-us/dnwxp/html/xpsp2web.asp#xpsp_topic5)
but it is not activated by default in all security levels: a security setting
can disable such error correction mechanism. 
"
http://developer.mozilla.org/en/docs/DOM:window.open#Note_on_position_and_dimension_error_correction


> Also, is there something I could do to reopen the bug, or is that up to the
> powers-that-be?

Fred, please read the bug writing guidelines document
http://www.mozilla.org/quality/bug-writing-guidelines.html
and the window.open() document
http://developer.mozilla.org/en/docs/DOM:window.open
carefully before adding any comment in this bugfile.
Thank you for your cooperation and understanding here.
Gérard
Thank you for your comments, Gérard, and sorry that I have been so late in
replying. I have managed to fix my problem since then, simply by resizing the
(main) Firefox window in its non-maximised state to a larger size than it was
before. Strange, but it works now, so I'm happy.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: