Move and resize browser window…

To move a browser window to a specific location on the users screen:

window.moveTo(x,y);

replacing “x,y” with pixel coordinates.

More info here, where they also have the below which will give you the users screen width, height:

screen.width
screen.height

Also, to resize the browser window:

window.resize(width,height)

Now, before you go all crazy on me - I’m not suggesting people do this for sport on their blogs. Messing around with people’s browser’s sizes, position, etc. will be annoying and NOT very usable. The reason why I needed the code above was to create a “minimize my browser” type effect with a bookmarklet for my mac (aka. “hide! the boss is coming”). The end result is this: mini-me

22 Responses to “Move and resize browser window…”

  1. Mariann Says:

    That is really nifty… I tend to have so many windows open on this damn PC that I can easily click back to Google or something harmless whenever someone comes near. I keep my desk facing everyone and everything so I’m generally prepared, but there’s always one time when I’m not… this is a nice trick to use!

  2. Donna Says:

    Oh. my. gosh. That’s so great! I feel so evil….

  3. Anabella Says:

    Not cool. Maybe have a warning for people using PCs to NOT click that window there?! I wasn’t able to maximize my window again! I had to restart and even then I had to do a full window to comment here. I don’t know why it’s doing this but I hope I can fix it. :/

  4. Jennifer Says:

    Anabella - I’m not sure why you had a problem. I’m on a pc right now and all it does is make the window smaller and moves it just above the taskbar… all had to do to “fix” it was pull the window up, and resize the browser again… Did it not let you do that??

    Can you email me what your OS/browser ver set up is?

  5. Richard Says:

    I clicked the ‘mini-me’ link, and this is what happened for me:

    1. The window turned into a small window in the bottom left-hand corner.
    2. I clicked the “restore” button.
    3. I clicked the “maximize” button. And the window I got only had the title bar and part of the toolbar visible, on the bottom of my screen, just above the taskbar.

    This under Windows XP with Internet Explorer 6. It works just fine in Phoenix (Mozilla-based browser), in that the maximize button is available in place of the ‘restore’ button.

  6. Jennifer Says:

    Ok, guys, please read this: To restore your browser back to normal, simply click on the title bar, drag the window up. Then click on the edges of the browser window and drag the sides out… that’s it.

    This script isn’t doing anything you can’t actually do on your own…

  7. Jennifer Says:

    Ok, NOW I see what the difference is. I never have my browser maximized, and *that* is what causes the problem.

    To correct the problem - while your browser is “maximized” (whever it is, even if it’s pushed down at the task bar) go to “file->Open” and copy and paste the below instead of a

  8. Anabella Says:

    Thanks ;)
    I restarted my computer, tried maximizing it again. Thing is first time around I couldn’t drag the window anywhere therefore I couldn’t resize it. Err. But it finally maximized. Am using Windows XP and IE6, too.

  9. WE ARE HUGH Says:
    Move and resize browser window…
    scriptygoddess: “The reason why I needed the code above was to create a
    “minimize my browser” type effect with a bookmarklet for my mac (aka.”

  10. Meredith Says:

    Aha! Thank you, Jennifer. I’ve had the same thing happen with the Cpanel 6 file manager, it’s great to have the fix.

  11. Natalie Says:

    WHEW good thing you posted that fix… having an invisible browser window is NOT cool! I’m on Win 2000 with IE 6.0.

  12. melanie Says:

    mine is IE6 on win98se, and thanks very much for the fix :)

  13. Jennifer Says:

    Needed an easy way/place to post this:

    Just for Geekgrrl :D
    (NOTE: If you have your browser maximized - I’m not sure what that will do to your screen so DON’T CLICK ON IT! - or if you do, be ready with the fix further up in the comments…)

  14. GeekGrrl Says:

    Sweet! You rock. :D
    Thank you.

  15. EeeEsss Says:

    Thank you sooo much, some @#&* site resized my browser window so that it was huge (Mac OS X) and I could not get to the handle in the corner to scale it down… what a relief.

  16. Karl Says:

    Oh, wow. Thank you. I just googled to find this. I had actually done something unrelated that permanently resized my maximized IE6. The javascript void you posted fixed it right up. Since I know you’re curious, I was checking out some websites deemed top quality, and visited http://www.baglionihotels.com. It’s really nice (and the hotels oh, so dreamy), but it did create the same problem some of the posters above had.

  17. timu Says:

    when resizing the window is it possible to show without all the gadgets: menu bar, scroll bar , etc.
    im using the code to load a page with an image 400×400
    thnx

  18. Jennifer Says:

    to do that - I think you have to launch a new window - and when you do that, you can specify which gadgets you want displayed (or not displayed)

  19. john Says:

    had the same problem with 98se and ie6, but i was able to unstick it - after it turned into a shortcut… oops :)
    but the reason i write is to say thanks, cuz this site just pops up when i google sometimes, and its always spot on. and CUTE!

  20. wiggles Says:

    Hi -

    I need something related, but I am new to CSS and can’t seem to find it.

    I need the CSS for a window to open to a specified size, and be on top.

    It is for my newsletter link, so I want them to be able to see it obviously!

    As timu asked, I would like it to be plain window. How do you specify which gadgets you don’t want displayed?

    Also, is there a way to re-direct the original window to the landing page of the newsletter window? That part may not be CSS, but it’s related, so I thought I’d ask…

    BTW - your cool little tool worked just fine on my PC in FireFox running XP!

  21. Jennifer Says:

    What you’re looking for isn’t CSS - it’s javascript. (actually the code above is javascript too) Try searching for “javascript open new window” in google - I’m sure there’s got to be lots of tutorials and scripts…

  22. wiggles Says:

    Oh, thanks.

    I thought I was supposed to do as much as I could in CSS because some people turn off their javascript, which would defeat the purpose.

    I figured that the size was part of the page layout, so there would be a CSS way. I thought CSS could do ANYTHING! ;)