Scripts may not close windows that were not opened by script

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
gauravshri12
Posts: 1
Joined: April 19th, 2017, 11:43 pm

Scripts may not close windows that were not opened by script

Post by gauravshri12 »

I have Logout Button in my web application & need to close the tab as soon as i click on logout button which is not happening at the moment in firefox rest other browser are working fine with the below solution.

Works fine in all browser except Firefox.

onclick="javascript:window.close();opener.window.focus();">
User avatar
DanRaisch
Moderator
Posts: 127166
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Re: Scripts may not close windows that were not opened by sc

Post by DanRaisch »

Moving to Web Development.
User avatar
Frenzie
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium
Contact:

Re: Scripts may not close windows that were not opened by sc

Post by Frenzie »

Other browsers are obviously broken. Users should be in control of their browser windows.

Why not simply redirect back to the login screen or to a news page or some such?
Intelligent alien life does exist, otherwise they would have contacted us.
isaacschemm
Posts: 270
Joined: January 20th, 2015, 12:29 pm

Re: Scripts may not close windows that were not opened by sc

Post by isaacschemm »

Maybe add a redirect after you run window.close(), that goes to a page saying "you can now close this window" or something similar.
Post Reply