Fix bookmarklet under Chrome

checkIsOnline isn't called before the connector gets used except in IE.

The mixed content blocker in modern IE combined with the https
redirect breaks communication with ZSA on all pages anyway, so we may
just want to give up on making the bookmarklet talk to ZSA.
This commit is contained in:
Simon Kornblith 2015-01-08 01:46:20 -05:00
parent 541ebd1f22
commit fa75beeefd

View File

@ -28,22 +28,17 @@ Zotero.Connector = new function() {
const CONNECTOR_API_VERSION = 2;
var _ieStandaloneIframeTarget, _ieConnectorCallbacks;
this.isOnline = null;
// 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
this.isOnline = Zotero.isBookmarklet && !Zotero.isIE ? false : null;
/**
* Checks if Zotero is online and passes current status to callback
* @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);