www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 1adf489801165243e50475a565ad5633782cbf75
parent 9f2d231741ad2ccd9f3e65a466b45f139a51ef9b
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu, 23 Sep 2010 06:10:04 +0000

Standalone: Open HTTP(S) URLs externally in default browser

Other URLs (such as zotero://attachment) won't work yet


Diffstat:
Mchrome/content/zotero/overlay.js | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js @@ -2557,6 +2557,18 @@ var ZoteroPane = new function() * shift-click == new window, no modifier == frontmost tab */ function loadURI(uri, event, data) { + if (Zotero.isStandalone && uri.match("^https?")) { + var io = Components.classes['@mozilla.org/network/io-service;1'] + .getService(Components.interfaces.nsIIOService); + var uri = io.newURI(uri, null, null); + var handler = Components.classes['@mozilla.org/uriloader/external-protocol-service;1'] + .getService(Components.interfaces.nsIExternalProtocolService) + .getProtocolHandlerInfo('http'); + handler.preferredAction = Components.interfaces.nsIHandlerInfo.useSystemDefault; + handler.launchWithURI(uri, null); + return; + } + // Open in new tab if (event && (event.metaKey || (!Zotero.isMac && event.ctrlKey))) { var tab = gBrowser.addTab(uri);