Close Window + Netscape7

A

Asit

<META HTTP-EQUIV="expires" content="0">
<META HTTP-EQUIV="pragma" content="no-cache">
<html>
<head>
<title>Fidelity NetBenefits</title>
</head>
<body BGCOLOR="#ffffff">

<script LANGUAGE="JavaScript">

function NoFramesAllowed() {
if (this.top != this) {
top.location.href=this.location.href;
return;
}
}

function CloseWindow()
{
if (window.name != "")
window.name = "";
window.close();
}


</script>

<center>
<table WIDTH="620" CELLPADDING="0" CELLSPACING="0" BORDER="0">



<tr><td></td><td COLSPAN="2"></td>
<td ALIGN="LEFT">
<form>
<input TYPE="BUTTON" onClick="CloseWindow()" VALUE="Click Here to
Close Your Browser">
</td>
</form>
</tr>
</table>

</center>
</body>
</html>

Save this as close.html

Open your Netscape 7 browser and then open this html file and click on
close button, it will not close the browser in Netscape but working
with Internet Explorer.

My Question is if the window is not being opened by the javascript,
then how to close the window by the Netscape ?

Is there any solution to this ?

Any help is appreciated.

Regards
Asit
 
M

Martin Honnen

Asit said:
function CloseWindow()
{
if (window.name != "")
window.name = "";
window.close();
}
<input TYPE="BUTTON" onClick="CloseWindow()" VALUE="Click Here to
Close Your Browser">
Open your Netscape 7 browser and then open this html file and click on
close button, it will not close the browser in Netscape but working
with Internet Explorer.

My Question is if the window is not being opened by the javascript,
then how to close the window by the Netscape ?

Check your Netscape 7 JavaScript console, it will probably show you a
message that script tried to close a window that it is not allowed to close.
As far as I know there is nothing you can do about that, with Netscape 4
you could use signed script to request the privilege to close the window
but that doesn't seem to be supported by Netscape 7.
 
L

Lee

Asit said:
function CloseWindow()
{
if (window.name != "")
window.name = "";
window.close();
}
Open your Netscape 7 browser and then open this html file and click on
close button, it will not close the browser in Netscape but working
with Internet Explorer.

My Question is if the window is not being opened by the javascript,
then how to close the window by the Netscape ?

This only works in Internet Explorer because of a bug.
You are not supposed to be able to close a window that
you didn't open with script.

The user certainly knows how to close his browser.
 
D

DU

Lee said:
Asit said:




This only works in Internet Explorer because of a bug.
Correct.

You are not supposed to be able to close a window that
you didn't open with script.

Correct. That's what MSDN says too. And even if a window was opened by
javascript, an user should be able to refuse that a script can close at
will the window (just as much as user setting, popup blocking software
can prevent scripts from opening new windows at will).

NS 7.2 and Mozilla-based browsers have
dom.allow_scripts_to_close_windows user pref setting which is entirely
under the control of users.
The user certainly knows how to close his browser.

DU
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top