Standalone: Open HTTP(S) URLs externally in default browser
Other URLs (such as zotero://attachment) won't work yet
This commit is contained in:
parent
9f2d231741
commit
1adf489801
1 changed files with 12 additions and 0 deletions
|
@ -2557,6 +2557,18 @@ var ZoteroPane = new function()
|
||||||
* shift-click == new window, no modifier == frontmost tab
|
* shift-click == new window, no modifier == frontmost tab
|
||||||
*/
|
*/
|
||||||
function loadURI(uri, event, data) {
|
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
|
// Open in new tab
|
||||||
if (event && (event.metaKey || (!Zotero.isMac && event.ctrlKey))) {
|
if (event && (event.metaKey || (!Zotero.isMac && event.ctrlKey))) {
|
||||||
var tab = gBrowser.addTab(uri);
|
var tab = gBrowser.addTab(uri);
|
||||||
|
|
Loading…
Add table
Reference in a new issue