![]() ![]() I was trying to investigate this, so i puttend some alert() to see wich line caused the crash. With this browser, infact, the page in wich the code is close itself instead of the opened one The problem exist for no browser than Microsoft Edge ![]() POPUP BLOCK IS ACTIVE, redirect the user to a page and ask him to enable popups ![]() Var test_open_windows = window.open(“”,”test_open_windows”,”width=1,height=1″) I use this code to check if the user have the popup enabled The opened window (window_to_close.htm): The launcher window (window_close_tester.htm): I tested using version 8.1 of Windows and Mac OS X 10.6, 10.9 & 10.10. I am calling it from a button press so it is **user initiated**, and it is still working fine using Chrome 35-40, Internet Explorer 11, Safari 7-8, and ALSO Firefox 35-40. The close option specification expects that it cannot be closed by anything other than the script that opened it… so this workaround basically attempts to reopen a window then close it: open(location, '_self').close() Most versions do not work anymore due to security restrictions. Be sure to click the ‘Open in New Window/Tab’ button on the page to open a new popup window, and then click the ‘Close This Window/Tab’ button on the newly opened window. A link to using script to open and script to close is included. You must use the complete code (HTML AND JAVASCRIPT BOTH!) for this to work. I have not seen any examples of modern browsers not working with this script if the above requirement has been met.įor those with hassles with window.close() or self.close() not working, there is a way for a JavaScript button to do this. If you are running any security programs, test the sample page first with them disabled if you are having issues. If you wish to close a page that has been posted via form, the page must first have still been opened in a separate window. NOTE: This script has 1 requirement that the page to be closed cannot be the original page. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |