Home > Web Front-end > JS Tutorial > body text

js implements the code to close the web page

小云云
Release: 2018-03-02 11:35:21
Original
3782 people have browsed it

This article mainly shares with you the js code to close the web page, hoping to help everyone.

<button  onclick="window.opener=null;window.open(&#39;&#39;, &#39;_self&#39;);window.close()">关闭</button>
Copy after login
Copy after login

Very simple way to close this page, no other additional prompts:

window.opener=null; //返回对创建该窗口的 Window 对象的引用。window.open('', '_self'); //方法用于打开一个新的浏览器窗口或查找一个已命名的窗口。window.close() //用于关闭浏览器窗口。
Copy after login
Copy after login

_self means opening a new page on this page, you can refer to the four attributes of target_ prarent,_blank,_selft,_top

<button  onclick="window.opener=null;window.open(&#39;&#39;, &#39;_self&#39;);window.close()">关闭</button>
Copy after login
Copy after login

A very simple way to close this page, no other additional prompts:

window.opener=null; //返回对创建该窗口的 Window 对象的引用。window.open('', '_self'); //方法用于打开一个新的浏览器窗口或查找一个已命名的窗口。window.close() //用于关闭浏览器窗口。
Copy after login
Copy after login

_self means opening a new page on this page, you can refer to it Look at the four attributes of target _prarent, _blank, _selft, _top

Related recommendations:

HTML close web page pop-up window code_html/css_WEB-ITnose

The above is the detailed content of js implements the code to close the web page. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!