Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Fix funky default window position in Safari Web Browsers

There's a well-known and very annoying bug in Safari 1.0 (I don't know if it's been fixed in the 10.2.8 update) that results in new windows being opened offset slightly down and to the right. The only fix I've seen advertised so far involves installing the Application Enhancer panel, something I'm not overly keen to do.

On further investigation, it appears that windows are correctly positioned if they are smaller than the screen width (i.e. don't have a width greater than 1024 on a 1024x768 monitor like mine) but get confused if they are set to be any larger, or are positioned outside the screen boundaries (if they are dragged to the right, for example - something I often do by accident.)

My solution is to set Safari's prefs to always start more or less fullscreen (leaving room for the dock) by issuing the following command:

defaults write com.apple.safari "NSWindow Frame BrowserWindowFrame" \
  '0 0 1024 685 0 0 1024 746'

The first two zeroes tell Safari to open the window at zero pixels from the top and right (so no offset, as it should be) and the next two values tell it that windows should be 1024 pixels wide and 685 pixels long. Your usage will vary here depending on your display - the important point to note is that the Safari window size should not be greater than your screen resolution.

You can fiddle around with this command until you find a setting that you like, and then save it as an executable .command file to make a quick shortcut, as a command line alias in your .tcshrc or (as I do), include it in your .login script.

[robg adds: I don't think the window offset is a bug, I believe it's a feature -- when you open a new window, you can see both the old and new windows at the same time. However, if it annoys you and you don't mind using full-screen windows, this should fix the problem (though I didn't experiment with it extensively).]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[11,175 views]  

Fix funky default window position in Safari | 35 comments | Create New Account
Click here to return to the 'Fix funky default window position in Safari' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fix funky default window position in Safari
Authored by: frankko on Sep 25, '03 11:17:17AM

It's called cascading, and it's definitely a feature. What's interesting is that the submitter of the hint (and apparently many others, from what is implied) thinks it's a bug, considering this is how every app on the Mac behaves.

Create a bunch of new windows in the Finder, each one will open down and to the right of the previous. Open a bunch of documents in Photoshop or BBEdit, they'll all open down and to the right of each other.

So... is it only a "problem" in Safari? Or am I missing something?



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: JKT on Sep 25, '03 12:08:43PM

It is a bug - what happens is the first window to appear after launching the app always opens offset to the right instead of in the top left corner of the screen, no matter how much you reposition it. It has nothing to do with cascading which is what occurs (naturally) once you open more windows.

---
iMacDV 400MHz, sl DVD-ROM, 10.2.6, 640MB RAM



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: adamsan on Sep 25, '03 11:27:44AM

Brilliant. Feature or not, I have a clamshell iBook that can only manage 800x600. New Safari windows always open with the right hand side off screen so I have to move them to see and use the vertical scroll bar. This solves that particular niggle nicely.



[ Reply to This | # ]
I think the poster meant this...?
Authored by: blueaudio on Sep 25, '03 11:30:57AM

I'm not sure, but I think what they meant was not just simple cascading, but a weird kind of placement. I get a behavior sort of like this in IE, here's how to reproduce it:

With the IE window at the top left, if you create a new window, it will cascade down and to the right such that the full title bar of the old window is seen, and it's roughly the same distance to the right.

Now close the new window, and move the original window slightly to the left until it's offscreen a tiny bit. Create a new window, and this time you'll see that the new window covers almost all of the title bar of the old window, and it's only shifted to the right about half as much as before. If you now create a third window, it will cascade the right distance from the second window.

This behavior confused me for a long time until I realized it was being caused by the first window's edge being slightly offscreen.

I just tested this in Safari, and it doesn't seem to happen when the original window is offscreen to the left, but I guess if it's offscreen to the right, it places the new window at the top left covering some of the title bar of the original window. I wouldn't really call that a bug, but the IE thing is maybe borderline bug.



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: designr on Sep 25, '03 12:01:37PM

This was perhaps the most irritating "feature" of Safari. I often go to pages that list hundreds of links. Instead of clicking forward and back over and over, I prefer to command-click each link which pops open a new window. Then command-w kills the new window leaving my original page in the foreground where I can instantly command-click the next link. Much faster and easier.

Safari used to make each subsequent new window slightly smaller than the last. After ten or fifteen new windows, the new windows are too small to see anything and would have to be manually resized. Then, ten or fifteen new windows after that they would be too small again...

The new Safari (10.2.8) is MUCH better. Windows don't shrink. They offset in a zig-zag pattern.



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: stukoch on Sep 25, '03 03:35:11PM

Why not just use tabs? Thats what they are there for...


-Stuart



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: designr on Sep 26, '03 11:49:30AM

I hate tabs. I hate them, I hate them, I hate them!

I still have to switch back and forth between pages and I end up with all these tabs hanging around that I'm already done reading.

But, what's really cool AND is finally fixed in Safari 85.5, I can position two browser windows side by side and draganddrop links from window 1 to window 2. If window 1 is a portal page like http://www.macsurfer.com/, I can jump from page to page in window 2 without ever losing focus in window 1.

This is so much faster and easier than tabs. I only ever have two windows open and never have to wait for window 1 to refresh. This also works for Bookmarks. Switch window 1 to your bookmarks and draganddrop them to window 2. I sometimes have three windows open: 1 for bookmarks and 2 for links so I don't have to stop reading while pages load.

Personal preference.



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: gklinger on Sep 25, '03 12:38:13PM
defaults write com.apple.safari "NSWindow Frame BrowserWindowFrame" \ '0 0 1024 685 0 0 1024 746'

The first two zeroes tell Safari to open the window at zero pixels from the top and right (so no offset, as it should be) and the next two values tell it that windows should be 1024 pixels wide and 685 pixels long.

Any chance of you telling us what the next four numbers do?

[ Reply to This | # ]

Fix funky default window position in Safari
Authored by: rgray on Sep 25, '03 01:17:05PM
Yes, please elabourate. In particular, why 685 and 746? (I get that it is size...) Is there some specific relationship between them that has to be observed?

[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: uberhacker on Sep 25, '03 03:27:07PM

Final four? I will shed some light on the final two. Two zeroes prior to that seem like top left.

I have found that the final two numbers correspond to the screen resolution - almost.

The second last number is the width of the screen, whereas the final number is the screen height minus 22.

I determined this by switching resolution up and down once and moving the Safari window around a bit then quiting then checking the default value again.

Individuals should do some more testing to see if this 22 pixel number changes if the window is moved off the screen, or depending on what extras are turned on (Bookmarks, Address, Status, etc.). I haven't bothered to check at this stage - too busy watching ST:TNG.



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: garroth on Sep 25, '03 06:23:41PM

the last 2 numbers are usable screen space, the screen resolution minus 22 pixels height which is for the menu bar at the top of the screen (this space is unusable)



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: Anonymous on Sep 26, '03 08:06:43AM

I definately wasn't clear in my original post :)

AFAICS, this really shouldn't have anything to do with cascading - like many others I am a devout user of tabs, and command click to open new ones. Because of this, I never need to have more than one window open, and yet quite often find that when I launch safari the window opens in a different position to where it was when i quit (i.e. off to the right.) Using the defaults command in the original post in fact has no impact on cascading, and new windows will still open slightly offset from previous ones.

I read an anecdote somewhere (quite likely here?) about apple engineers demonstrating an early build of safari and tearing their hair out over this 'feature,' which I think is why I was so convinced it was a bug.

Still, six and half a dozen I guess...

And regarding the numbers 685 and 746 in the original command, I believe (as someone already pointed out) that the latter is usable screen height, and the former is the intended default height of the safari window upon launch. It's shorter because I keep the dock visible at the bottom of the screen.



[ Reply to This | # ]
Why use windows? Use TABS!!!
Authored by: blueamoeba on Sep 25, '03 12:49:08PM

I simply installed Saft and chose "Always open browser window in tab". In Safari's General prefs choose "Open links from applications...in the current window". I'll NEVER deal with pesky windows again.



[ Reply to This | # ]
Why use windows? Use TABS!!!
Authored by: Bin_jammin on Oct 02, '03 02:39:50PM

Wow, I've been looking for something like Saft for months, thanks for the post, I love this!



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: hembeck on Sep 25, '03 02:14:48PM

Cascading new windows does not bug me. But what I feel is a funky Safari window behavior involves tabs.

I like to keep my window the entire length of the screen: From the bottom to the main Finder menu, to the top of the dock. But if I close a tab, Safari takes it upon itself to shrink the length of the remaining window down.

Anyone know how to kill this behavior?

Fernando

---
--Health, Wealth and Happiness--



[ Reply to This | # ]
closing last tab shrinks Safari window
Authored by: hayne on Sep 25, '03 02:53:42PM

Thanks for mentioning this. I also usually keep my browser windows at the full height (not width!) of the screen. And I'd noticed that the windows sometimes got shorter but I hadn't correlated it with the tab behaviour. Now that I understand what is happening (Safari shrinks the window when the last tab gets closed), I'm going to report it as a bug via the (Safari menu) Bug mechanism. You should report it too and maybe enough people will protest that they will consider fixing this soon.



[ Reply to This | # ]
closing last tab shrinks Safari window
Authored by: Dale Sorel on Sep 25, '03 03:42:19PM

Open the Safari Preferences and check "Always show tab bar."



[ Reply to This | # ]
always show tab bar
Authored by: hayne on Sep 25, '03 04:21:35PM

But I don't want it to always show the tab bar. That takes up useful vertical space.
I want it to leave my window the size I resized it to - no matter what the internal contents are. I repeat that this is a bug and if enough people report it, it might get fixed.



[ Reply to This | # ]
always show tab bar
Authored by: heraklit on Sep 25, '03 07:01:43PM

Maybe you should reconsider what you think a "bug" is. Safari developers gave you two options. You'd prefer a third. That's not a bug; that's a feature request.



[ Reply to This | # ]
window size is set by the user
Authored by: hayne on Sep 25, '03 09:54:51PM

No, this is not a feature request. It's a bug.
It's a general rule, not something particular to Safari.
The size of the window is something that is set by the user.
Except in very special circumstances, the application should never change the window size. The application should decide how best to use the window space provided by the user, but never resize the window by itself.



[ Reply to This | # ]
window size is set by the user
Authored by: jiclark on Sep 25, '03 11:34:51PM

Sorry, I have to agree with the others. It's "resizing" because the tab bar is going away, but the area filled with actual content is staying the same. Try this: go to Finder and open a window. Then hit cmd-B to toggle the toolbar on and off. Same thing happens here; the window gets "smaller" because you're hiding one of its elements. The visible "productive" area of the window stays the same, but overall it gets smaller when the toolbar goes away.

This is the same thing that Safari is doing!

---



[ Reply to This | # ]
window size is set by the user
Authored by: hembeck on Sep 26, '03 11:32:35AM

Regardless of whether it's a bug or not (let's stop the debate now...It's to much like the chicken and the egg debate,) the horizontal length of the window has been set by me, the user, so why does Safari insist on shrinking it? Bug or not, it's annoying.

When the tab bar is closed, that's all that should happen. The physical window length should not change.

Maybe the discussion is being confused by not understanding the definition of 'window'. What I'm referring to is the entire browser window, which include the tool bar and bookmarks bar, not just the space for HTML content.

Like a previous poster said, leaving the preference to always show the tab, eats away at the content space, put yet it preserves the browser window length.

-Fernando

---
--Health, Wealth and Happiness--



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: vonleigh on Sep 25, '03 02:30:24PM

I actually don't like cascading. I would like them all to open in the same place. Unfortunately the only solution seems to be to install APE, something that I won't do on a production machine.

v



[ Reply to This | # ]
...don't like cascading windows...
Authored by: jiclark on Sep 25, '03 04:07:14PM

I agree. So somewhere along the line I came up with the following AppleScript:

tell application "Safari"
activate
if not (exists document 1) then return "no document"
end tell

tell application "Safari"
set the bounds of window 1 to {0, 22, 1275, 1050}
end tell

I then appended the script (using iKey) to the cmd-n new window command. I also have a shortcut that invokes it I need be otherwise. And I think I also applied one of the "defaultswrite" commands to keep it from happening when Safari first starts up...

Hope this helps some of you. It's *always* bothered me.

---



[ Reply to This | # ]
...don't like cascading windows...
Authored by: jiclark on Sep 25, '03 04:09:36PM

I realized that my comment made it sound like I wrote that script. I don't remember where I got it (I actually think it was here), but I did *not* create it myself. I may have edited it a bit though...

---



[ Reply to This | # ]
another easy re-size option
Authored by: Krioni on Sep 25, '03 05:02:42PM
Another easy way to re-size your windows quickly is to make a Javascript bookmarklet and put it as the first bookmark in the Bookmark bar. Then you can just hit Command-1 to re-size the window to the full screen (leaving room for the dock).

javascript:self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);

I think I got that from macosxhints.com.

[ Reply to This | # ]

another easy re-size option
Authored by: phil4u2 on Sep 26, '03 01:26:04PM

Actually, there's another "Feature" or "bug" (whichever you wanna call it) that really bugs me...
Safari always opens new windows at the same size and place as the last opened window (If you opened a pop-up window that's tiny, and then closed it, new windows will open at that last size, tiny)

I wrote a HTML page, saved it locally, and use it as my start page. (in the general preferences, chose start-page)

Here's the code of the page:

<html>
<title>Start full size</title>
<body>

<script language="JavaScript">
<!--
if (window.screen) {
window.moveTo(0,0);
self.resizeTo(screen.availWidth - 150 ,screen.availHeight);
}
//-->
</script>

<script language="JavaScript">
<!--
function redirect()
{
window.location = "http://www.google.com"
}

setTimeout("redirect();", 1)
// -->
</script>

</body>
</html>

What it does, it first places the page at the top left of the screen, and then maximizes it minus 150 pixiels on the right. Then it redirects the page to a page of your choice (in that case, www.google.com).

Works for me!



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: gmachen on Sep 27, '03 01:14:59PM

I cannot find fullscreensafari.ape anywhere; the original mac.com homepage seems to have evaporated. Anyone know where it can be downloaded? Or can someone post it on a server somewhere so we can download it? Thanks!



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: Angus on Sep 26, '03 07:56:44AM

This is great. I'll try this technique in Word X. I've got a MS Word print dialog that always appears with the bottom off screen. One of the Word prefs has some settings that look like they relate to window position.



[ Reply to This | # ]
Confusion
Authored by: Anonymous on Sep 26, '03 04:58:16PM

I think what some people are confused about is the difference between the traditional Mac OS window cascading behaviour (normally exhibited by Carbon apps) and the 'free' window cascading behaviour that comes with Cocoa apps. The Cocoa behaviour is fundamentally flawed, primarily because windows can cascade off the right-hand side of the screen, obscuring the scroll bar and making the window virtually unusable without user intervention.



[ Reply to This | # ]
Re: Confusion
Authored by: jiclark on Sep 27, '03 05:35:46PM
This is a very excellent point. One that needs to pointed out to Apple! Many times over!

---


[ Reply to This | # ]

Fix funky default window position in Safari
Authored by: kerouassady on Sep 29, '03 12:57:01PM

My boss has this issue and its not just window cascading. When he launches Safari, the default window that appears is hanging half off the screen. He can move the window or close it but all new windows (not opened links just CMD-N new windows) appear to the right of the screen hanging off it. Hopefully, this will work.



[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: Saint on Oct 08, '03 05:11:29PM
I have come to terms with this issue. What confuses me is the poster's problem with Unsanity Application Enhancer. Did you have a bad experience, are you a little slow? I have something like way too many enhancers installed because i love the functionality of each, and i still have no problems.

[ Reply to This | # ]
Fix funky default window position in Safari
Authored by: rim on Nov 04, '03 10:05:50PM

I have an additional issue here that may/may not be related.

I have a setup that seems to allow me to pull the entire titlebar behind the finder's menubar. If I do so, it renders the window unmovable because I can no longer reach the titlebar to drag it (oh how I wish dragging from all sides was back).

Tossing the prefs for the app doesn't fix this, and it does affect every app, including the finder.

Ideas?



[ Reply to This | # ]
cascading window position not a problem in IE
Authored by: corrp on Feb 11, '04 02:11:51PM

Note, Internet Explorer 5.2 (now abandoned because Safari exists) does not have this window problem. It knows where the right edge of the screen is located.



[ Reply to This | # ]