A few bookmarklets in your browser

Developing for the web has more than enough of its share of quirks and problems and one which I will help you solve here: How to very easy test how your website behaves and look like in different screen sizes. With the help of your browsers bookmarks and a line of JavaScript.

Using the javascript function window.resizeTo we can create bookmarklets. They are just lika ordinary bookmarks, but in stead of taking you to a new page or site they can manipulate the content of your browser. Such as the window size:

Drag these to your bookmarks bar:   Fill   1024   800

You will need a modern browser, FireFox and Safari will work this trick like a charm (Opera, however does not accept these scripts). In your browser of choice create a new bookmark, rename it to e.g. Test for 1024×768 screens and for the content of the bookmark, paste this code into that field:

A bonus for Safari users: If you put these bookmarklets in your bookmarks bar and press ⌘+n where n is the order in which the bookmark lies in counted from left to right. On the image above, invoking the 800 bookmarklet would be done with ⌘+3.

Vill du veta mer?