Resize & reposition your browser "bookmarklets"

  • April 7th, 2007

Firefox browser bookmarks toolbar

Firefox bookmarks bar [screenshot] with various bookmarklets for resizing & repositioning the browser window

On a fairly regular basis, I find myself resizing & repositioning the browser window in order to "work happy". Be it general web browsing, web development, or multi-tasking, the browser window and position has a noticeable impact on what I’m doing. Being fairly detail oriented, I prefer resizing & positioning the browser window – in relation to other application windows – to specific pixel coordinates. At one point, I was using a special wallpaper [grid] which helped line elements up to their respective coordinates.

Realizing that the task of resizing & repositioning the browser window could be simplified using JavaScript browser bookmarklets, I created and added similar snippets to accommodate my needs on a 2560×1600 resolution screen:

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

The above will resize the browser window horizontally to 1280px, and vertically to the constraints of the work area. If the dock is hidden (OS X), the browser height would be 1600px. If the dock is visible, the vertical height would be y minus the height of the dock.

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

Alternatively, in order to center a browser window with a max width of 1024, the above snippet would do the trick. The general math to calculate the x,y coordinates for self.moveTo(x,y) can be gathered with the following:

  • Decide on the max-width of the browser window – 1024
  • Divide the horizontal resolution of your screen by 2 – 2560px / 2 = 1280
  • Divide your anticipated browser width by 2 and subtract this figure from the centerline – 1280-(1024/2)=768

Using 1024 as the max-width for the browser window on a 2560×1600 resolution screen, the coordinates to center the browser window would be self.moveTo(768,0);. Confused? That’s OK. Right-click on any of the links below for your respective screen resolution and select "Bookmark this link". Saving the links to your browser bookmarks bar will provide you with quick access to resize and center your browser window.

Note that in order for the above browser bookmarklets to work, you will need to make sure that JavaScript browser window resizing is not disabled in your browser preferences.

Firefox browser preferences

Double-check to make sure that your browser settings do not disable JavaScript browser window resizing

What other browser bookmarklets do you use on a regular basis? Add your recommendations in the comments so that others might benefit as well.

Get the Best Software for your Computer

Looking for the best software on the web? Sometimes it can be tough to find things like landscape software, while other programs like music software seem to be everywhere. Thankfully the internet is full of all types of software, so there’s sure to be something for everyone.