Need to open/close windows with JavaScript

Jaiem's picture

They have: 1,191 posts

Joined: Apr 1999

I have the code to open a window with JS but want to know how (if possible) to:

1) Open the window minimized.

2) CAutomatically close the window after a certain number of seconds.

Thanks.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I've never seen a window open minimized. Do you have an example?

Closing is easy, window_name.close()

detox's picture

They have: 571 posts

Joined: Feb 2001

Put this in the body of your pop-up...

onload="setTimeout('self.close()',5000)"

5000 - 5 seconds by the way.

Only problem here is there is a security(?) feature of IE and possibly NN that prompts the user to allow for the window to close.

here is some more info on this, this example assumes you are closing the window from the parent page:

javascript:window.close()

will close windows without a prompt;

1) if the window was originally opened with JavaScript, or
2) if the window was originally opened with a specified TARGET other than _self.

On "AnotherSite.html": Your Page

On "YourPage.html", there is another link:
Close

This link will close the window because it was opened using TARGET from "AnotherSite.html".

Regarding the minimise window... looking at that now, If I find anything I will get back to you.

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.