Click here to Skip to main content
15,907,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
function CloseBrowser(){
openedWindow =window.open('','_self','');
openedWindow.close();

here is the code i am using to close a browser with a button click .It works fine with chrome and IE but it fails to work in FireFox .I get error saying that cannot close a file that was not opened by a script.

My C# application is opening a webpage demo using

C#
ProcessStartInfo startInfo;
startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Minimized;


startInfo.Arguments = aPath2 + "/demo.html";
Process.Start(startInfo.Arguments);

can anyone help me
Posted
Updated 28-Sep-12 0:18am
v2

1 solution

In your Process.Start(startInfo.Arguments),

Change to:

C#
Process proc = Process.Start(startInfo.Arguments);


Then you can use proc.Kill later on. You can also grab proc.ProcessID if you are doing all of this in different threads.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900