0

I'm doing a small project in c# win form, and when i open two links with:

process.start("http://www.example.com");
process.start("http://www.example2.com");

that's all working properly, but what i want is the two links open in new browser windows when they have to open(e.g. button click, on form load etc.).

how can i do that? I searched the web and mostly found ASP.net and such..

Thanks in advance, Vincent

yizzlez
  • 8,757
  • 4
  • 29
  • 44
Daeh
  • 3
  • 4
  • Rather than launch the URL, you would launch the browser with the URL as a parameter. The downside being it wouldnt use the default browser. – crthompson Mar 11 '14 at 23:22

1 Answers1

2

You won't be able to do it by having the shell invoke the default browser the way you're doing it. You'll have to call start the browser explicitly. For example, if you want to use Internet Explorer:

Process.Start("iexplore.exe", "-noframemerging http://www.example.com");

The -noframemerging command line option should prevent it from launching in an existing window. You can find out more about Internet Explorer command line options here: Internet Explorer Command Line Options

Unfortunately, if someone prefers a different browser, it will still launch Internet Explorer, even if a different browser is configured as their default browser.

You could maybe create a dropdown asking them to pick a browser and then run the appropriate command.

itsme86
  • 19,266
  • 4
  • 41
  • 57
  • Here [link](http://stackoverflow.com/questions/13621467/how-to-find-default-web-browser-using-c) you can find how to get default system browser. So you would not need to start iexplore. – Vasily Semenov Mar 12 '14 at 02:24