mike chambers | about

Opening an URL in an External Browser from a Thunderbird Extension

Here is a quick code snippet that shows how to open a URL in an external browser from within a Thunderbird extension:

var url = "http://www.mikechambers.com";
var uri = Components. classes["@mozilla.org/network/io-service;1"]. getService(Components.interfaces.nsIIOService).newURI(url, null, null);

var com = Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"];
var httpHandler = com.createInstance(Components.interfaces.nsIExternalProtocolService);

httpHandler.loadUrl(uri);

This will open the URL in the system’s default web browser.

twitter github flickr behance