Jump to content

JS close() Problem


Kowa92

Recommended Posts

Hi All! I've a problem with this code that doesn't work... And i don't understend where is the mistake... This is the code:

<a href="javascript:window.close();" >Close Main Window</a>

Why this doesn't work? I've the Chrome Browser... But i tryed with Mozzilla Firefox too, but however doesn't want to work... Why?

Link to comment
Share on other sites

From what i understand, that function only works when you open a window with the window.open() function.
Okay, thanks for your suggestion... But, how can i close a (main) window that i haven't open with the "open()" command?
Link to comment
Share on other sites

It's a security issue. Just because your page is active in a window does not mean you "own" the window. A user may have 50-pages of history and forms in a window that they don't want to lose. That makes closing the window their choice, not yours.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...