Javascript Popup opens window off-screen

RESOLVED WORKSFORME

Status

RESOLVED WORKSFORME
17 years ago
14 years ago

People

(Reporter: andrixnet, Assigned: Matti)

Tracking

Trunk
x86
Windows 95

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

17 years ago
Mozilla 1.0RC3 build 2002052306
Using 800x600 resolution.

Go to http://www.st.com and use the upper left search box to search for a part
(ie. STV5730A as I tried)
In the returned results page, click on link "STV5730A" below "Part number". It
will open a new window via Javascript Popup.

This new window is positioned offscreen, meaning that only the lower half of the
button bar is visible and the title bar is completele off the screen. If I
wanted to move this window, I am unable to, since the title bar is not visible.
Note that window is about 400 pixels high, so it would fit on screen completely.

Clicking on the sides of this window and resizing it will result in the window
jumping down, aside from the resize, so that part of the title bar becomes visible.

This is not normal behaviour and I would expect such a new window (via
javascript popup) to be displayed with the titlebar on screen, no matter what,
and if window is taller than vertical resolution of the display, then the lower
part of it to be invisible, not the upper part. 
Otherwise I cannot move it, close it, etc. 

I've seen the same behaviour on many pages that feature a link with Javascript
popup.

Comment 1

17 years ago
Thank you for such accurate steps to reproduce this.
The link "STV5730A" below "Part number" fires this function:

  popup('/stonline/bin/sftab.exe?table=109&filter0=STV5730A','selector')

This function is defined in 
  view-source:http://www.st.com/stonline/jscript/getscreen.js


function popup(winurl,winname,bar)
{
  height = 380; width = 640;
  if ( screen.width > 840 ){ width = screen.width - 200; }
  if ( screen.height > 580 ){ height = screen.height - 200; };

  popupwin=window.open('',winname,'width='+width+',height='+height+
                                  ',scrollbars,resizable,toolbar,status');
  if (bar)
  { 
    popupwin.document.writeln ("<HEAD>")
    popupwin.document.writeln ("<TITLE>ST on LINE</TITLE>")
    popupwin.document.writeln ("</HEAD>")
                     etc.
  }
  else
  {
    popupwin.document.writeln ("<HEAD>")
    popupwin.document.writeln ("<TITLE>ST on LINE</TITLE>")
    popupwin.document.writeln ("</HEAD>")
  }

  popupwin.document.close();
  popupwin.focus();
}

Comment 2

17 years ago
Created attachment 86436 [details]
Reduced testcase

Comment 3

17 years ago
This is not a JS Engine issue. Reassigning to Browser-General 
until we can get further information -

Andrei: when you try the reduced testcase, does the same problem occur?
Assignee: rogerl → Matti
Component: JavaScript Engine → Browser-General
QA Contact: pschwartau → imajes-qa
(Reporter)

Comment 4

17 years ago
Reduced testcase: works fine. New window appears with titlebar just below the 
link I click.

Tested www.st.com following the same steps. It works. Window is opened in the 
exact same position as in the reduced testcase. I don't understand.

At the time it behaved like I described it, after I reported it, when I restored 
a window from maximized to normal, it also got offscreen, and was larger then 
the 800x600 of the display. Empty window, nothing in it.

This is odd behaviour and probably something hard to track down. 
Before I encountered the original issue, I visited various sites that had ads in 
popup windows which opened wildly, then repositioned, then resized themselves.
Possibly related to some Javascript that set default values which changed later 
(?) or upon restart? 
I tried to visit as many sites with unsolicited popups in a similar fashio 
before I got to www.st.com and had the page at st.com open and periodically I 
tried, but could not reproduce it.

I will keep a watch for this one and if I can reproduce it again, I will add 
more info here.

Comment 5

17 years ago
Andrei: thanks for your careful testing of this. Based on your
current results, I'm going to resolve this one as WORKSFORME.
Please reopen it should the problem reoccur.

One idea: is it possible that you changed your screen resolution
to 800 x 600 while Mozilla was running? If so, Mozilla does not
take this information into account (e.g. in calculating Screen.height)
unless you restart Mozilla. See bug 62395 and its many duplicates.

I wonder if that's what happened here?
Status: UNCONFIRMED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → WORKSFORME
(Reporter)

Comment 6

17 years ago
Based on your suggestion pschwartau@netscape.com I tried out the following:

- Set screen to 1024x768
- open Mozilla
- open reduced testcase
- change screen resolution to 800x600
- clicked on link that pops up a new window. 

A new window appeared, with title bar on screen, with width and height larger
then when running the testcase exclusively at 800x600. (it seems indeed that
Mozilla does not take into account screen resolution changes for Javascript...

Again, I was not able to reproduce :(

What looked to me as a possible pattern, but hard to track is the following: 
- when some ads open new unsolicited windows, sometimes (couldn't determine
rule), the testcase opened the new window with upper-left corner in the same
position as the ads window. As this does not happen always, and it's pretty
vague, I can't say anything for sure.
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.