Jump to content

Recommended Posts

Dear All,

 

 

Below is my script for closing a window, I intend to close the window. Please help me out.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
       
       <title>

       
       Thank you!
       
       </title>

       
<body bgcolor="#808080">

                       <br>
                       <br>
               <h2><P ALIGN=Center>Thank you for voting on our website!</h2>
               <h3><P ALIGN=Center>We will e-mail you the results of the experiment shortly!</h3>
                       <br>
                       <br>
               <P ALIGN=Center><a href="login_success.php">Click here to go back and change your votes</a>
               <br>
               <br>
               <P ALIGN=Center><a href="" onclick="window.close();return false;">Click here to close this window</a>        
</body>


</html>

 

It is not working as I intend it to work, any suggestions??

Even if I try the below code, it gives me the error:

 

Not Found

 

The requested URL /self.close() was not found on this server.

 

Here's the script:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<title>


Thank you!

</title>


<body bgcolor="#808080">

		<br>
		<br>
	<h2><P ALIGN=Center>Thank you for voting on our website!</h2>
	<h3><P ALIGN=Center>We will e-mail you the results of the experiment shortly!</h3>
		<br>
		<br>
	<P ALIGN=Center><a href="login_success.php">Click here to go back and change your votes</a>
	<br>
	<br>
	<P ALIGN=Center><a href="self.close()">Click here to close this window</a>	
</body>


</html>

 

Please suggest modifications asap. Thank you.

I am not sure if my window is opened using javascript...and self only works if a window is opened using javascript. Can you please help me out in this regard? I want it to work on all the platforms. Thank you.

 

You could try top.close(); or parent.window.close();

 

onclick="javascript: top.close();"

What window are you trying to close then? If you're not trying to close a child window is it a main window or something completely different? You must know if its being created with JavaScript or not because you would have created it.

It is a page written in html/php, i tried HTML script using self.close() but it is also giving the not found error...help!

 

What window are you trying to close then? If you're not trying to close a child window is it a main window or something completely different? You must know if its being created with JavaScript or not because you would have created it.

It is not the parent of the entire website...it is the page that opens after the user is done using the website for the purpose it was intended to do...

 

Why would you want to close a page you've just loaded if its the parent of your entire website?

I am sorry but same error....I guess I need to put the source code file on the server in the same folder for all these functions self.close, windows.close() etc.

 

So you open an entirely new window and then want to close it so they can view the main website again? In that case top.close() document.close() window.close() parent.window.close() should all work....

  • 2 weeks later...

If JavaScript did not open the window, then JavaScript cannot close the window in most web browsers. This was implemented as a Security Feature. Nothing you can do about it. If JavaScript did open the window, then your first script should work.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.