Close the browser

R

Randy

Hello,
I'm trying to find a way to close the browser with out the IE security
message "The Web page you are viewing is trying to close the window."
message. I know how to close the browser using Javascript (window.close())
but I would not like to get this message.
Is there a way to close it in C#?

Thanks
 
D

darrel

I'm trying to find a way to close the browser with out the IE security
message "The Web page you are viewing is trying to close the window."
message. I know how to close the browser using Javascript (window.close())
but I would not like to get this message.
Is there a way to close it in C#?

Controlling the browser is a client-side behavior, so you have to use
javascript. And whether or not you get those types of errors is entirely
dependant on the browser. Typically, you can close any window you open, but
not ones that the user has opened themselves.

-Darrel
 
M

Matt Berther

Hello Randy,

Prior to calling window.close, set window.opener to a non-null value. Ex:

window.opener = this;
window.close();
 
B

Bruce Barker

though hopefully, IE will fix this security bug someday.

-- bruce (sqlwork.com)
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top