This tip shows you how to set Safari 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
Related posts:
- How to get latitude and longitude from Google Maps
- Centering your web page using HTML and CSS
- Why is my Adobe Flash website not loading?
- How do I backup my MySQL database?
- What CGI center scripts are installed?
Tags: browser, code, example, how-to, safari, testing, webdesign