Open links in external browser other than IE

A few people have mentioned that the "open links in external browser" functionality always uses Internet Explorer (even if this is not your default browser). I would assume this does not happen when you double-click an item as I simply call System.Diagnostics.Process.Start(url) to open the link. If even a double-click still uses IE, please let me know.

As far as this behaviour goes for clicking links from within the embedded browser, all I currently do is put a <base target="_blank"> in the <head> section of the generated html. Going to another browser will no doubt be more involved than that - I'll have to check if there's some event I can hook into for this behaviour. Any pointers on how to implement this would be most appreciated.

TrackBack URL for this entry: http://www.hutteman.com/scgi-bin/mt/mt-tb.cgi/24
Comments

You are correct, the links do only open in IE when you click on links in the content pane. Good job on the app!

Posted by Clint Ecker at April 7, 2003 12:53 AM

About a year ago, I changed my default browser to Netscape instead of IE. Every time I clicked a link in Outlook or Messenger, I got an empty IE window. I looked it up on MSDN and found that it was a known bug (and several years old) with no good workaround. I changed my default browser back to IE and it didn't solve the problem. I worked off and on for a week before finally finding a beta build of IE sp1 and installed it, which solved the problem.
I think that using IE embedded will cause IE to open by default, regardless of your windows choices.
Leveraging Monopoly/bug/undocumented feature/whatever.

Posted by sirshannon at April 7, 2003 1:17 AM

This could be coming far out from left field, but, perhaps not having another solution, maybe you could employ VBscript and run the URL through the system rather than letting IE handle opening it in a new window. It would require being a trusted site, but I'd figure IE might automatically consider local pages trusted. May be worth checking out.

Alternatively, you could also try supporting Mozilla's ActiveX control as an option, but that may leave other browsers in the dark.

Love the app. Syndirella was instantly removed... ;)

Posted by teeb! at April 7, 2003 6:28 AM

I'm on the SharpReader train also
I'm on the SharpReader train also

Trackback from .NET Brain Droppings at April 7, 2003 12:32 PM

My own personal Jolt award goes to... SharpReader!
My own personal Jolt award goes to... SharpReader!

Trackback from .NET Brain Droppings at April 7, 2003 12:34 PM

SharpReader rocks
SharpReader rocks

Trackback from Urs Bertschy Blog at April 7, 2003 2:05 PM

Luke,

Here is some VB code (should be very easy to translate to C#) that I have used in the past. I have not tested this with 98/me.

By the way, is your project open source?

Thanks,
Don

ps. you can test this in 98/me by going to the run window and typing it in.

-- vb code --
Private Const SPAWN_BROWSER_APPLICATION As String = "rundll32.exe"
Private Const SPAWN_BROWSER_ARGS As String = "url.dll,FileProtocolHandler"

Private Sub SpawnBrowser(ByVal url As String)
'This is how you spawn the user's default browser:
'rundll32 url.dll,FileProtocolHandler URL

Dim pinfo As New ProcessStartInfo(Me.SPAWN_BROWSER_APPLICATION, _
Me.SPAWN_BROWSER_ARGS + " " + url)
pinfo.EnvironmentVariables.Item("Path") = Environment.GetEnvironmentVariable("Path")
pinfo.UseShellExecute = False

Process.Start(pinfo)
End Sub

Posted by Don McNamara at April 7, 2003 2:49 PM

Switching to Sharpreader...
Switching to Sharpreader...

Trackback from Joshua Prismon's Technical weblog at April 7, 2003 2:51 PM

If you hook the Navigate event you could pull out the URL, cancel the event and then execute your System.Diagnostics.Process.Start(url) code... You'd have to know the difference between the navigate event that you start by navigating to the initial entry and one started by a click... but I think this is manageable.

Posted by Duncan Mackenzie at April 7, 2003 2:53 PM

How I handle this in my app is on my browser control I handle StatusTextChange to record the URL since by default it is set as the status text and NewWindow2 to handle the actual spawning of a new window. There is probably a better way of determining the URL, but I was already capturing it for my app through the status text changes.

----

private string url;

private void OnStatusTextChange(object sender, AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEvent e) {
url = e.text;
}

private void OnNewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e) {
Process.Start(url);
e.cancel = true;
}

Posted by Gabe Kruger at April 7, 2003 3:26 PM

Syndirella has the capability of opening links in the content pane in a different browser. Maybe you could look at that?

Posted by tamaracks at April 7, 2003 10:27 PM
This discussion has been closed. If you wish to contact me about this post, you can do so by email.