Resize and Reposition Your Browser with JavaScript

resize-browser Don’t you have it when you have lost your perfect spot for your browser window in your desktop layout and you have to put it back by dragging it over, then resizing each corner till it is back in that perfect spot yet again?  Well, with the help of a little JavaScript you can take the mess out of resizing and repositioning your browser.

Why Resize and Reposition Firefox Automatically?

When working I usually like to keep up a chat window, a notepad program and Firefox.  The notes and chat can stay a little smaller, stacked on top of each other on the side but Firefox needs to be in the left over big space.  So this is the JavaScript I used to put in in its spot:

javascript:resizeTo(1024,1000);self.moveTo(640,10);

That says to keep the browser 1024 in width, 1000 pixels high and to move to to the desktop location of 640 pixels left and 10 pixels down.  If you used:

javascript:resizeTo(1024,1000);self.moveTo(0,0);

That would set it up to be in the top left corner.  Depending on your screen size those last two numbers are what you want to change to get the position right and the first two number would be your browser size.  There is probably some mathematical way to figure out the right number for the position you want – but if your like me you just changed the numbers around till you got it in the position you need.  What if you wanted the browser height to be all the way from the top of the screen to the bottom?  In that case you could change the second number in resizeTo (in both examples that would be the 1000) to screen.availHeight.

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

Notice now that by copy and pasting this into your address bar and hitting enter will make the browser as tall as it can be, with the width of 1024 pixels and in the left side of the screen.

How do You Create the Resizing Bookmark?

Now how can you create a bookmark to do this in Firefox?  Simple.  Right-click on your bookmarks toolbar, and select “New Bookmark”.  Name can be anything.  I call mine – Resize Browser.  Location is where you want to type in the JavaScript string above.  In keyword, type in a simple tag such a “r” or “resize”.  That way when you type in “r” into the address bar – it will automatically resize Firefox back to your perfect location.   Description can be left blank.  Hit the Add button, and you are done.

In the memory of every great cooking show I have ever seen, let me take a page out of their book and give you a link to drag into your bookmark toolbar so you can see the effects of this simple desktop organizational hack:

Now I know somebody will bring up the fact that a number of extensions will do this same action too.  This provides a way of simply adding the feature in without the need of another add-on.

javascript-settings Having Problems? 

To use these JavaScript tips, remember you have to have JavaScript enabled in your Firefox options.  Go to Tools > Options and then the Content Tab.  Make sure there is a check mark next to “Enable JavaScript”.  Also, in the Advanced settings be sure to allow scripts to move or resize existing windows.

With a little help from JavaScript and some creativity you will never lose your favorite browser size on your desktop.

  • http://www.ssokolow.com/ Stephan Sokolow

    Unfortunately, I don’t like letting JS mess with my browser sizing. Fortunately, I’ve got two monitors and I just maximize on one of them.

    Even better, as a Linux user, I could have either my Window Manager or a window-manipulating script do this sort of thing without having to poke a hole in my Javascript sandboxing.

  • http://www.ssokolow.com/ Stephan Sokolow

    Unfortunately, I don’t like letting JS mess with my browser sizing. Fortunately, I’ve got two monitors and I just maximize on one of them.

    Even better, as a Linux user, I could have either my Window Manager or a window-manipulating script do this sort of thing without having to poke a hole in my Javascript sandboxing.

  • eren

    I used that javascript code and now my firefox always opens with that resolution. I want my firefox to remember the windows size of last session like it doed before. How can I turn everything back to normal?

  • eren

    I used that javascript code and now my firefox always opens with that resolution. I want my firefox to remember the windows size of last session like it doed before. How can I turn everything back to normal?

  • http://svdogpark.org/community/index.php?action=profile;u=235;sa=summary Alica Szerbin

    When I recently came across your blog and have been following along, I was thinking I’d add my first comment. I don’t know what to say apart from I appreciated reading. Awesome blog. I am going to carry on dropping by this website on a regular basis.

  • http://luxorlending.com/?p=431 Anastacia Acocella

    You sure do know what youre referring to. Guy, this blog is just excellent! I cant wait to understand far more of what youve obtained to express. Im genuinely happy that I came across this when I did due to the fact I had been really starting to get bored using the whole blogging scene. Youve turned me around, guy!

  • http://dadshrine.com/forum/index.php?action=profile;u=196;sa=summary Kip Redenbaugh

    Excellent post. I hope more people had straightforward and direct posts just like your own. Thanks :)

  • http://plugcomputer.org/plugforum/index.php?action=profile;u=8066 Sydney Hildenbrand

    I should say, as much as I enjoyed reading what you had to express, I couldnt support but lose interest after a whilst. Its as if you had a great grasp on the subject matter, but you forgot to consist of your readers. Perhaps you must take into consideration this from much more than a single angle. Or maybe you shouldnt generalise so very much. Its far better should you think of what others may have to express as opposed to just going for the gut reaction to the theme. Consider adjusting your own believed method and giving other people who may go through this the benefit from the doubt.

  • http://promics.blogspot.com Livia Heagney

    I must say, as much as I enjoyed reading what you had to convey, I couldnt help but lose attention after a while. It’s as if you had a fantastic grasp on the subject matter, but you forgot to include your readers. Perhaps you should think of this from more than 1 perspective. Or maybe you shouldn’t generalise so much. It’s better if you think of what others might have to express rather than just going for the gut reaction to the topic. Think of adjusting your own thought procedure and giving other people who may browse this the benefit of the doubt.

  • http://www.walemusic.com/profiles/blogs/galvanic-spa-reviews Joshua Vanallen

    I need to say, as a lot as I enjoyed reading what you had to express, I couldnt help but lose interest after a while. Its as in the event you had a excellent grasp on the topic matter, but you forgot to include your readers. Possibly you ought to think of this from much more than one particular angle. Or perhaps you shouldnt generalise so very much. Its much better if you consider what others may well have to express instead of just going for a gut reaction on the theme. Take into consideration adjusting your own thought method and giving other people who might study this the benefit from the doubt.

  • http://saconkling.com Kathlyn Akoni

    wow…taylor lautner is so hot!

  • http://knol.google.com/k/anonymous/-/3houio0859kva/4 zero cost commissions

    Really good blog post man, I certainly like the look and additionally the feel of this amazing blog website. You write essentially well, you should certainly be a aware guy. Will really come back

  • http://www.ecotonejournal.com/index.php/member/15498/ zero cost commissions

    Maintain up the very good operate mate. This website article indicates how properly you recognize and know this subject.

  • http://bravenewconversations.com/index.php/member/17543/ zero cost commissions

    You simply saved me atleast 1 hour of time. I am making a project at this topic and your blog has helped me through one of the topics of my project. I will browse to the other pages now.

  • http://video.blogwidow.com/zerosecretinstrument zero cost commissions

    Terrific post bro. This valuable is just a tremendously nicely structured article post on the blog, just the knowledge I was searching to find. Kudos

  • http://sophiabushfan.org/forum/index.php?action=profile;u=16417 zero cost commissions

    A actually great article by you my good friend. We have bookmarked this web page and can arrive again following several days to examine for just about any new posts which you make.

  • http://wirelessu.org/user/4729 zero cost commissions

    Creative post on the blog bro. This kind of is just a surprisingly nicely structured page, just the info I was searching pertaining to. Thank you really very much

  • http://www.muiss.org.au/forums/index.php?action=profile;u=12078 zero cost commissions

    Incredible article which has obtained me considering concerning the possible of the idea. Actually actually wonderful.

  • http://wildcats.ehclients.com/index.php/forums/member/20715/ zero cost commissions

    The content on this article is really 1 of the top material that I’ve ever are available across. I love your submit, I’ll are available back to examine for new posts.

  • http://the-starport.net/modules/profile/userinfo.php?uid=8617 zero cost commissions

    Truly actually beneficial weblog publish which has got me considering. I never looked at this from your point of view.

  • http://www.yamipod.com/main/userinfo.php?uid=52044 zero cost commissions

    I am definitively thankful to you for providing us with this invaluable documents. My spouse and I are honestly grateful, exactly the resources we needed.

  • http://vip.hitfmradio.com/zerosecretinstrument zero cost commissions

    This has definitely sparked up an idea in my mind. This really is a superb weblog article.

  • http://www.imbrat.com/cpa-instruments-review/cpa-instruments-review-what-noone-else-will-revealbonuses-2000 cpa instruments

    Nice piece of info that you’ve got in this website publish. Hope I can get some a lot more of this stuff on your website. I’ll arrive back.

  • http://www.imbrat.com/cpa-instruments-review/cpa-instruments-review-what-noone-else-will-revealbonuses-2000 cpa instruments

    Wow! That is one particular of the most effective blogs I’ve at any time are available throughout on this subject. Merely Amazing

  • http://www.imbrat.com/cpa-instruments-review/cpa-instruments-review-what-noone-else-will-revealbonuses-2000 cpa instruments

    It is really a fabulous way of seeing things. An submit like this suggests exactly how seriously the concept is believed by publisher.

  • http://www.imbrat.com/the-last-traffic-secret-review/the-last-traffic-secret-review-elite-versionbonuses-worth-2000 the last traffic secret review

    I am so happy to read this. This is the kind of insight that needs to be given and not the random misinformation that is at the other blogs. Many thanks this impressive page.

blog comments powered by Disqus