scriptygoddess

27 Feb, 2003

Move and resize browser window…

Posted by: Jennifer In: Script snippet

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

February 27th, 2003 at 10:36 am

Avatar

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

February 27th, 2003 at 11:45 am

Avatar

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

3 | Anabella

February 27th, 2003 at 5:17 pm

Avatar

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

February 27th, 2003 at 5:26 pm

Avatar

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

February 27th, 2003 at 8:37 pm

Avatar

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

February 27th, 2003 at 10:11 pm

Avatar

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

February 27th, 2003 at 10:40 pm

Avatar

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

February 27th, 2003 at 11:49 pm

Avatar

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 | Meredith

March 1st, 2003 at 10:14 am

Avatar

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

10 | Natalie

March 1st, 2003 at 11:28 pm

Avatar

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

11 | melanie

March 5th, 2003 at 7:12 am

Avatar

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

12 | Jennifer

March 5th, 2003 at 10:56 am

Avatar

Needed an easy way/place to post this:

Just for Geekgrrl 😀

(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…)

13 | GeekGrrl

March 5th, 2003 at 1:34 pm

Avatar

Sweet! You rock. 😀

Thank you.

14 | EeeEsss

April 30th, 2003 at 5:34 pm

Avatar

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.

15 | Karl

July 15th, 2003 at 11:17 pm

Avatar

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.

16 | timu

February 9th, 2004 at 10:04 am

Avatar

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

17 | Jennifer

February 9th, 2004 at 10:13 am

Avatar

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)

18 | john

March 21st, 2004 at 11:28 pm

Avatar

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!

19 | WE ARE HUGH

February 28th, 2003 at 12:43 pm

Avatar

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."

20 | wiggles

March 16th, 2005 at 7:48 pm

Avatar

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

March 17th, 2005 at 12:41 pm

Avatar

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

March 17th, 2005 at 3:51 pm

Avatar

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! 😉

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements