Home > Article > Web Front-end > js implements closing this page, does window.close() really not close the page of the chorm browser?
The content of this article is about closing this page using js. Is it true that window.close() cannot close the page of the chorm browser? , has certain reference value, friends in need can refer to it, I hope it will be helpful to you.
window.close()
However, window.close() can only close the page opened through window.open('url');
So, the idea: The current page is closed by executing window.open() on this page, followed by window.close();.
The code is as follows:
window.opener = null;//禁止某些浏览器的一些弹窗 window.open('','_self'); window.close()
The problems I encountered during the implementation process:
Entering the above code into the console of the opened chorm browser page does not work accomplish. However, it is possible to enter the above code in the newly opened chorm page console. Therefore, after writing an index.html for actual testing, the above code does not have the above problems.
The above is to close this page for js. Is window.close() really not able to close the page of the chorm browser? Full introduction, if you want to know more about JavaScript video tutorial, please pay attention to the PHP Chinese website.
The above is the detailed content of js implements closing this page, does window.close() really not close the page of the chorm browser?. For more information, please follow other related articles on the PHP Chinese website!