Home > Web Front-end > JS Tutorial > Summary of several methods of JS closing windows and JS closing pages_javascript skills

Summary of several methods of JS closing windows and JS closing pages_javascript skills

WBOY
Release: 2016-05-16 17:08:49
Original
1110 people have browsed it

The first type: JS automatically closes the window at a scheduled time

Second type: Click the link to close the window with JS without prompt
Close the window

Third type: The window does not prompt for automatic closing js code


How to close the window without prompting in IE6-7 JS

Method 1:
js code
function CloseWin() //This will not prompt whether to close the browser
{
window.opener=null;
//window.opener=top;
window.open("","_self");
window.close();
}

Method 2:
open.html
js code
function open_complex_self() {
var obj_window = window.open('close.html', '_self' );
obj_window.opener = window;
obj_window.focus();
}

close.html
js code
window.close();

Attached:
//Normal closing with prompts
function closeie(){
window.close();
}
//Close IE6 without prompting
function closeie6(){
window.opener=null;
window.close();
}
//Close IE7 without prompting
function closeie7(){
window.open('','_top');
window.top.close();
}

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