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
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.
External Links
Sponsors
Web Hosting – £2.99/mo
Reliable UK web hosting. Free tech support. Trusted UK host since 2004. Free setup. Order online.
http://ecenica.com/
cPanel Hosting – £4.99/mo
Fast cPanel hosting with email. Choice of UK/US servers. 30-day money-back promise. Founded 2004.
http://ecenica.com/
Related posts:
- How to get latitude and longitude from Google Maps
- How do I backup my MySQL database?
- How do I check my email using Outlook and Outlook Express?
- How to save an HTML signature in Apple Mail
- What CGI center scripts are installed?
Tags: browser, code, example, how-to, safari, testing, webdesign