FlorianSL
FlorianSL

Reputation: 89

A program that ask you which web browser you want to use

I want to make a simple program that ask you which browser you want to use. When you'll click on a link (email or pdf for example), a program will appear instead of the browser and will ask you which browser you want to use.

First : in which code it's the best to write this? Secondly : How to open the program and not the browser?

I need a bit of help to write this, because i don't know how begin

Upvotes: 0

Views: 74

Answers (2)

Raviraj Palvankar
Raviraj Palvankar

Reputation: 879

For C#: This will open the url in the default browser:

string url = "http://google.com/";
System.Diagnostics.Process.Start(url); 

This will open the url in the specified browser:

System.Diagnostics.Process.Start(@"C:\Program Files\Mozilla Firefox\firefox.exe", url); 

There will be an error if the browser does not exist.

Upvotes: 1

Kempeth
Kempeth

Reputation: 1948

This is tricky. There is no uniform event for "User clicks on url" that spans all applications.

The most straightforward solution would be to create your application and register it as the default browser.

Personally I would be annoyed by having to select a browser each time I click a link so I would probably make a helper application that when it starts remembers the current default browser and then registers the browser selector as the default. And when the helper closes it would restore the default browser.

My Java is quite rusty but I think this should be possible in either language. Maybe a little trickier in Java due to the lack of a dedicated executable for your application.

Upvotes: 2

Related Questions