2008/10/22

Tips: Closing browser without asking users

In some cases I need to close browser without popping up a window to asking, and here is what I found that really works:
window.open('','_self','');
window.close();
or

window.open('','_parent','');
window.close();

The use of _self or _parent will depend on the situation. When users click the "Exit" button on a page, I will use the _self. When the user select "Yes" to leave on a confirm window pop up, I will use the _parent so that the browser will close correctly.

No comments:

Post a Comment