Scripts may not close windows that were not opened by scrip

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
User avatar
harilal
Posts: 5
Joined: October 20th, 2014, 7:18 am

Scripts may not close windows that were not opened by scrip

Post by harilal »

Hi Fire Fox Team,
We are getting an error
"Scripts may close only the windows that were opened by it" while using the code

window.open('','_self').close(); (or what ever the code that i got by goggling for closing the window)

and it's calling in the on load script using "window.onload=closeBr;"

We want to auto close the browser when user log out .

Is there any solution for this issue?

-Thanks & Regards,
Harilal.A.S.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

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

Post by patrickjdempsey »

harilal wrote:We want to auto close the browser when user log out .

Is there any solution for this issue?

-Thanks & Regards,
Harilal.A.S.


Websites are not allowed to close the browser.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
DanRaisch
Moderator
Posts: 127222
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
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

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

Post by trolly »

An extension may be able to do this.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
User avatar
harilal
Posts: 5
Joined: October 20th, 2014, 7:18 am

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

Post by harilal »

trolly wrote:An extension may be able to do this.


Could you please share your thoughts on this?

Thanks & Regards,
Harilal.A.S.
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

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

Post by trolly »

An addon/extension has higher access rights and may monitor a specific web site and close firefox. Personally, I have no real idea how to do this. You may ask in the "Extension development" forum.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
User avatar
harilal
Posts: 5
Joined: October 20th, 2014, 7:18 am

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

Post by harilal »

trolly wrote:An addon/extension has higher access rights and may monitor a specific web site and close firefox. Personally, I have no real idea how to do this. You may ask in the "Extension development" forum.


Thank you, I will analyse more on this option.

The real bottle neck is that, the auto close is working for some other browsers irrespective of versions. And the end users going to use this. So in common we are not able to force end users to use a specific browser or not ask to change some settings on browser. And the end users may consider this as a bug in development other than browser issue.

So am searching more on this....
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

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

Post by trolly »

Basically, allowing to close a browser by a web page is considered a security risk by Mozilla.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
User avatar
jscher2000
Posts: 11758
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

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

Post by jscher2000 »

You can display a message that says "You can close this window now". I think your users should be able to handle that.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

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

Post by patrickjdempsey »

harilal wrote:The real bottle neck is that, the auto close is working for some other browsers irrespective of versions.


Like IE? You cannot use IE as a judge as to what safe browser behavior is.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
harilal
Posts: 5
Joined: October 20th, 2014, 7:18 am

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

Post by harilal »

jscher2000 wrote:You can display a message that says "You can close this window now". I think your users should be able to handle that.


Hi,
We already tried to show the message (exactly the one that you told) instead of closing the browser, but the client team not satisfied
Thanks & Regards,
Harilal.A.S.
Last edited by harilal on October 21st, 2014, 2:53 am, edited 1 time in total.
User avatar
harilal
Posts: 5
Joined: October 20th, 2014, 7:18 am

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

Post by harilal »

patrickjdempsey wrote:
harilal wrote:The real bottle neck is that, the auto close is working for some other browsers irrespective of versions.


Like IE? You cannot use IE as a judge as to what safe browser behavior is.


Hi,
Not tested in IE, but in "Safari" the auto close feature is working fine (Our clients commonly work with Mozilla Fire Fox, Safari, Chrome, IE etc)
Thanks & Regards,
Harilal.A.S.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

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

Post by patrickjdempsey »

Like IE, Safari will also automatically run installable files when you download them. Again, Safari is not a good example of safe browser behavior.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

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

Post by trolly »

If this is allowed some hackers may be able to inject an advertisement that closes the browser when the user tries to close or leave the site. It is not really a good idea to allow that.
And if the user has scripts disabled it will not work anyway.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
Post Reply