Kowa92 Posted January 1, 2013 Share Posted January 1, 2013 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 More sharing options...
Don E Posted January 1, 2013 Share Posted January 1, 2013 From what i understand, that function only works when you open a window with the window.open() function. Link to comment Share on other sites More sharing options...
Kowa92 Posted January 1, 2013 Author Share Posted January 1, 2013 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 More sharing options...
Don E Posted January 1, 2013 Share Posted January 1, 2013 you can try <a href="javascript:self.close()">Close the window</a> but I dont think that works in most/all browsers. Link to comment Share on other sites More sharing options...
jeffman Posted January 2, 2013 Share Posted January 2, 2013 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now