In Safari, why are windows opened via Javascript 2 pixels wider and 1 pixel higher than requested?
I googled for the answer no avail, so made a simple test page, and asked for answers on a (usually quite reliable) local mailing list, but haven’t got an answer. So, I posted the test page to my linklog in the hope of it gaining a wider audience. A few hits, but no answer .
So: now, I’m re-posting the question here to drizzle a little google-juice on the test page, and hope one of my legion of trusty feed subscribers can spring to my assistance.
I suppose a keyword-stuffed rephrasing of the question could be: Is there reliable cross browser way or technique for opening a fixed-size window via Javascript or with DOM browser scripting (
window.open or similar)?
Published at 10:46 pm on March 20th, 2005.
Topics: Markup and CSS
6 Comments
Just found this uber-test page for javascript popup windows.
Comment by Tim at 4:54 pm on March 23rd, 2005 #link
An update: since this article was posted, Safari has been updated. (The most current version at the time of posting was Safari 1.2.4 [v125.12]). The new version (1.3 for Mac OS 10.3.9) fares much better, giving the correct width, but still not the right height (it seems to be 1 pixel shorter than requested).
Comment by Tim at 11:50 pm on April 24th, 2005 #link
In Safari 2.0 (Under tiger) the width seems to be fine in your test page, but the height opens 1 pixel short. First too long… now to short ?!? What the hell Apple. I seem to be having trouble with Javasscript all over the place. Google Maps no longer works at all.
Comment by paul at 2:30 am on June 4th, 2005 #link
Hi,
I had exactly the seem problem (sort of) Safari and FF on mac both do seem to have this problem. I fixed the wrong size by resizing them within the popup window itself by using some of the cross-browser xLibrary and the following lines of code:
window.resizeBy(950-xWidth(document),665-xHeight(document))
Comment by Ruud at 4:49 pm on February 17th, 2006 #link
Some of my previous remarks were left out, but check this website for xWidth and xHeight: http://www.cross-browser.com/
Comment by Ruud at 4:51 pm on February 17th, 2006 #link
I googled this post and thought I would add this new comment.
Having a similar problem with IE 7.0 after upgrading. IE now makes my popups wider than specified by the window.open() stuff. Very annoying! I googled everywhere, and no good info. For my 215px wide, 270px high popup, IE adds 35px’s to the width. Maybe I’m doing something wrong, but they worked before in all browsers and now only IE screws them up!
If you know a fix, post anywhere and I will eventually find it.
Comment by Dwight Vietzke at 6:50 pm on August 1st, 2007 #link