From 9ee67ca29163606a6bf90d3baefa465c8b346ae4 Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Tue, 9 Dec 2014 13:12:05 -0600 Subject: [PATCH] Disable ZSA ping from bookmarklet in non-IE browsers This means that bookmarklet will only save to server. --- .../content/zotero/xpcom/connector/connector.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/connector/connector.js b/chrome/content/zotero/xpcom/connector/connector.js index 4b0cf8de86..156656953a 100644 --- a/chrome/content/zotero/xpcom/connector/connector.js +++ b/chrome/content/zotero/xpcom/connector/connector.js @@ -35,8 +35,20 @@ Zotero.Connector = new function() { * @param {Function} callback */ this.checkIsOnline = function(callback) { + // As of Chrome 38 (and corresponding Opera version 24?) pages loaded over + // https (i.e. the zotero bookmarklet iframe) can not send requests over + // http, so pinging Standalone at http://127.0.0.1 fails. + // Disable for all browsers, except IE, which may be used frequently with ZSA + if(Zotero.isBookmarklet && !Zotero.isIE) { + callback(false); + return; + } + // Only check once in bookmarklet - if(Zotero.isBookmarklet && this.isOnline !== null) callback(this.isOnline); + if(Zotero.isBookmarklet && this.isOnline !== null) { + callback(this.isOnline); + return; + } if(Zotero.isIE) { if(window.location.protocol !== "http:") { @@ -267,4 +279,4 @@ Zotero.Connector_Debug = new function() { callback(true, reportID); }, {"Content-Type":"text/plain"}); } -} \ No newline at end of file +}