Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q308 When using window.close() some pages ask 'Close Window? (yes/no)' and others don't, why?

irt.org | Knowledge Base | JavaScript | Window | Q308 [ previous next ]

Q308 When using window.close() some pages ask 'Close Window? (yes/no)' and others don't, why?

Its a security thing. It'll work without asking if there is only one location in the browsers history, if theres more than one, it prompts the user for confirmation. If this becomes a problem, you can always restrict the history of a window to one location by using the replace() method, for those browsers that support it.

If the window was opened from Javascript (like window.open() method), while closing those windows, user will not be prompted. Where as if the window was opened self, like (Target='-blank' etc), while closing those windows, user will be prompted.

Feedback on 'Q308 When using window.close() some pages ask 'Close Window? (yes/no)' and others don't, why?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.