Resize Safari 5
New Window Safari Bookmarklet
Safari 5 blocks window resizing using JavaScript. A neat work around is to use the following code which will open a new Safari window sized to 1024×768.
javascript:open(location,'1024:768','innerWidth='+(1024)+',innerHeight='+(768)+','location=yes, menubar=yes, toolbar=yes');
You can also drag this bookmarklet to your Bookmark Toolbar
[bookmarklet javascript=”open(location,’1024:768′,’innerWidth=’+(1024)+’,innerHeight=’+(768)+’,scrollbars=yes’);” title=”New 1024×768 Window”]
Safari 4 and older
This tip shows you how to set Safari 4 and older, to 1024px x 768px and auto-center the browser window – all with just one click.
It’s achieved by adding a new Safari Bookmark which links to a snippet of JavaScript. You can then set your browser size by just clicking on your Bookmark Toolbar. Useful for taking uniform screen-grabs or screen-captures.
The Code
- Open Safari
- Click Bookmarks > Add Bookmark. Or press Apple+D
- Name your bookmark |1024|
- For the address enter
javascript:self.resizeTo(1024,768);self.moveTo(parseInt((screen.availWidth/2)-(1024/2)),parseInt((screen.availHeight/2)-(768/2)));
- And that’s it!
Now make sure you’ve closed any Safari tabs and then click your new bookmark. If you’ve copied it correctly, Safari will resize and jump to the center of your screen.