Closed
Bug 79475
Opened 23 years ago
Closed 20 years ago
resizeTo() and moveTo() resize iframe's parent window.
Categories
(Core :: DOM: Core & HTML, defect, P3)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: jeffrey.phillips, Assigned: jst)
Details
(Keywords: testcase, Whiteboard: [good first bug])
Attachments
(3 files)
309 bytes,
text/html
|
Details | |
506 bytes,
text/html
|
Details | |
2.33 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
resizeTo or moveTo javascript functions are invoked on an iframe's parent window instead of the iframe window object itself. Steps to reproduce: 1. Create main.html with the following text: <html> <head><title>Main Page</title></head> <body> <p>Test of resizeTo and moveTo in an iframe:</p> <p><iframe src="iframe-test.html" width="200" height="200"></iframe></p> </body> </html> 2. Create iframe-test.html with the following text: <html> <head> <script language="javascript"> <!-- // Test to make sure this and this.parent are not the same. // If they are the same then we are probably not an iframe // inside a window. if (this != this.parent) { // Will affect parent frame not the iframe, but should. this.resizeTo(10,10); this.moveTo(0,0); } else document.write("You're not in an iframe!"); //--></script> </head> <body> <p>In da iframe.</p> </body> </html> 3. Open main.html and the whole window will be resized and moved instead of just the iframe. Have tried this with many different ways of getting the iframe window object and all result in the same behavior (viz- document.__parent__.resizeTo, document.getElementById("myIframe").resizeTo, etc.)
Reporter | ||
Comment 1•23 years ago
|
||
Cannot find any specific examples at this time, but this was noticed because an iframe banner ad resized my browser window.
Comment 2•23 years ago
|
||
over to DOM0.
Assignee: pollmann → jst
Status: UNCONFIRMED → NEW
Component: HTMLFrames → DOM Level 0
Ever confirmed: true
QA Contact: amar → desale
Assignee | ||
Comment 3•23 years ago
|
||
What does IE do if you call resizeTo() in an iframe?
Reporter | ||
Comment 4•23 years ago
|
||
In IE, both resizeTo and moveTo will affect the IFRAME object and not any of the parent or child frames.
Assignee | ||
Comment 5•23 years ago
|
||
Targetting for mozilla1.0
OS: Windows 2000 → All
Hardware: PC → All
Target Milestone: --- → mozilla1.0
Comment 6•23 years ago
|
||
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 (you can query for this string to delete spam or retrieve the list of bugs I've moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Comment 7•23 years ago
|
||
SEVERITY = LOW [(1)No Crash, (2)functional failure, (3)No Cosmetic failure] VISIBILITY = HIGH [(1)Reporter says that he noticed this bug when iframe banner ad resized his browser window, which means real website usage is high. (2)Gets one point of compatibility with other browsers since it works very well on IE. (3)Gets one more point on compliance with adopted techonology which is JS] PRIORITY = VISIBILITY * SEVERITY Hence Priority = p3 adding word "qawanted" because I'm setting this priority on available data & if someone feels otherwise then please investigate this more & feel free to change this priority.
Keywords: qawanted
Priority: -- → P3
Assignee | ||
Updated•22 years ago
|
Target Milestone: mozilla1.0.1 → ---
Comment 8•21 years ago
|
||
This seems to have been outstanding for a long time and is not fixed in Netscape 7. There is a workaround that seems to work but is a bit messy and obviously a full implementation would be best:- var w = 50; var h = 100; if (document.all) resizeTo(w,h) else { var fname = this.name; if (fname != "") { parent.document.getElementById(fname).width = w; parent.document.getElementById(fname).height = h; } } The problem with this is that you must name the IFRAME in the parent document, and you have to allow for IE browsers as unless your IFRAME document is coming from the same server you cannot change the properties of the IFRAME in IE. ResizeTo will always work in IE. See www.dpnsoftware.net for demo.
Assignee | ||
Comment 9•21 years ago
|
||
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Comment 10•21 years ago
|
||
The bug also happens when trying to resize a XUL iframe in a XUL window. The warkaround proposed in #8 does not work (re-assigning the height/width properties of the XULElement/HTMLElement seems not to be taken into account).
Comment 11•20 years ago
|
||
Comment 12•20 years ago
|
||
This testcase shows that calling iframe.contentWindow.resizeTo() inside the parent window or window.resizeTo() inside the iframe resizes the parent window, not the iframe.
Updated•20 years ago
|
Comment 13•20 years ago
|
||
So the problem is that the window object page scripts see _is_ an iframe, effectively. Hence to get the desired behavior for scripts we map resizeto/moveto calls on any window to the root window...
Comment 14•20 years ago
|
||
Does IE behave the same way for <frame> and <iframe>?
Comment 15•20 years ago
|
||
Another example (IFrame Code) <html><head></head><body onLoad=\"javascript:self.resizeTo(0,0);\"></body></html>
Comment 16•20 years ago
|
||
This has been fixed for a month for resizeTo (see bug 248870). jst, mind fixing moveTo as well?
Whiteboard: [good first bug]
Comment 17•20 years ago
|
||
All this really needs is an IsFrame() check in nsGlobalWindow::MoveTo, like nsGlobalWindow::ResizeTo has.
Assignee | ||
Comment 18•20 years ago
|
||
Seems like sizeToContent() needs this check too, so I added that while I was at it.
Attachment #170584 -
Flags: superreview?(bzbarsky)
Attachment #170584 -
Flags: review?(bzbarsky)
Comment 19•20 years ago
|
||
Comment on attachment 170584 [details] [diff] [review] Fix per bz's suggestion. Looks good. r+sr=bzbarsky
Attachment #170584 -
Flags: superreview?(bzbarsky)
Attachment #170584 -
Flags: superreview+
Attachment #170584 -
Flags: review?(bzbarsky)
Attachment #170584 -
Flags: review+
Updated•20 years ago
|
Assignee: general → jst
Assignee | ||
Comment 20•20 years ago
|
||
Fixed.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•