|
-
Dec 12th, 2008, 03:09 PM
#1
Thread Starter
Fanatic Member
Close browser window without prompt
Hi all,
I'm using the following javascript to close a browser window:
Code:
Response.Write("<script language='javascript'> { window.close();}</script>")
It works good but I get the confirmation prompt. Is there a way I can modify the above syntax so it closes the browser window without the confirmation prompt? I'm using VS 2008 and ASP.NET 2.0
Thanks,
Strick
-
Dec 14th, 2008, 11:41 PM
#2
Re: Close browser window without prompt
If you did a forum search you'd come across this solution posted by Mendhak a little under one month ago. It should work but it's evil. EVIL!
-
Dec 15th, 2008, 10:46 AM
#3
Thread Starter
Fanatic Member
Re: Close browser window without prompt
Hello,
Thank you for you response. I still get the prompt even when using the code from the post you provided. Here is how I'm using it:
Code:
Response.Write("<script language='javascript'> { window.opener='blah';window.close();}</script>")
Thanks,
Strick
-
Dec 15th, 2008, 11:24 AM
#4
Re: Close browser window without prompt
Not sure then as it's something I've never fiddled with. I'm sure Mendhak will come across this post and help with his own code though, heh.
I always thought the opener being the same as the parent would allow you to close it but his code goes the other way so I'm not sure.
-
Dec 15th, 2008, 05:33 PM
#5
Frenzied Member
Re: Close browser window without prompt
Hm.. it works for me. What browser you used? I used in this context:
HyperLink1.NavigateUrl = "javascript:window.opener='blah';window.close();";
-
Dec 17th, 2008, 11:37 AM
#6
Thread Starter
Fanatic Member
Re: Close browser window without prompt
Hi, Using IE7. Haven't tried it on IE6 yet? Also I'm using the response.write to execute the javascript in my code (the code I'm using is in my previous post) so I don't have to assign it to a hyperlink. My code works, but it's still prompting to close the window. But if I have to use a hyperlink to do it I guess thats the way I'll have to go. I'll try that this evening when I get home and let you know.
Thanks for your help.
Strick
-
Dec 23rd, 2008, 03:13 AM
#7
Re: Close browser window without prompt
Remove the curly braces. They mean nothing if it's not in a function.
-
Dec 23rd, 2008, 03:14 AM
#8
Re: Close browser window without prompt
PS: Yes, quite evil. What have I unleashed!
-
Dec 23rd, 2008, 06:09 AM
#9
Re: Close browser window without prompt
 Originally Posted by mendhak
Remove the curly braces. They mean nothing if it's not in a function.
The curly braces just define a block and not necessarily a function .
-
Dec 24th, 2008, 01:16 PM
#10
Re: Close browser window without prompt
Keep your code clean.
-
Apr 9th, 2009, 06:05 PM
#11
New Member
Re: Close browser window without prompt
 Originally Posted by stricknyn
Hi, Using IE7. Haven't tried it on IE6 yet? Also I'm using the response.write to execute the javascript in my code (the code I'm using is in my previous post) so I don't have to assign it to a hyperlink. My code works, but it's still prompting to close the window. But if I have to use a hyperlink to do it I guess thats the way I'll have to go. I'll try that this evening when I get home and let you know.
Thanks for your help.
Strick
For IE7 you can use this:
window.open('', '_self', '');
window.close();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|