Open new window after page finishes loading

They have: 318 posts

Joined: Mar 1999

Hi,

Where can I find a script that opens a new window (with specified width, etc) after a page finishes loading?

Sabrina

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Use the onLoad call in the body tag:

<BODY onLoad="window.open('url','name','width=100,height=100');">

Just add and set the other attributes you need for the window and it should do it.

[This message has been edited by John Pollock (edited 26 April 2000).]

They have: 318 posts

Joined: Mar 1999

Thanks! hey, is there a way to automatically center the webpage in the user's window when it loads?

Sabrina

[This message has been edited by SabrinaP (edited 26 April 2000).]

They have: 1,587 posts

Joined: Mar 1999

a meta refresh tag may be able to do it too.

------------------
CLICK 4 some tested resources for making money $, hosting, and web promotions.
My Site got hacked, but i'm coming back?

Traffic-Website.com free traffic, affiliate programs, hosting, & domain names.
My Site got hacked, but i'm coming back?

They have: 231 posts

Joined: Feb 2000

If you want to center the new window on your page then you will have to find the X/Y dimensions yourself. Use the following code as a guide.

code:

var windowWidth = 400;
var windowHeight = 300;
var winX,winY,winFeatures;

function openWindow() {
   winX = (screen.width - windowWidth) / 2;
   winY = (screen.height - windowHeight) / 2;
   winFeatures = "width=" + windowWidth + ",height=" + windowHeight + ",screenX=" + winX + ",left=" + winX + ",screenY=" + winY + ",top=" + winY;
   window.open("URL","NAME",winFeatures)
   }[/code] 

:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.