Test by IE7/ Firefox 3.0/ Google Chrome
CloseDemo.htm
<script>
var browserName=navigator.appName;
if (browserName=="Netscape")
{
function closeme()
{
window.open('','_parent','');
window.close();
}
}
else
{
if (browserName=="Microsoft Internet Explorer")
{
function closynoshowsme()
{
window.opener = "whocares";
window.close();
}
}
}
</script>
<input type="button" value="close me 3" onclick="closeme();"/>
<script>
var browserName=navigator.appName;
if (browserName=="Netscape")
{
function closeme()
{
window.open('','_parent','');
window.close();
}
}
else
{
if (browserName=="Microsoft Internet Explorer")
{
function closynoshowsme()
{
window.opener = "whocares";
window.close();
}
}
}
</script>
<input type="button" value="close me 3" onclick="closeme();"/>
Note:
If you are using Firefox, please make sure your settings:
1.type "about:config" into your address bar, and enter.
2.find the key named "dom.allow_scripts_to_close_windows" make sure the value is True
OK, enjoy the code