diff --git a/source/js/diva.js b/source/js/diva.js index 1d32617d..0a17e7cc 100644 --- a/source/js/diva.js +++ b/source/js/diva.js @@ -62,6 +62,7 @@ module.exports = diva; enableImageTitles: true, // Adds "Page {n}" title to page images if true enableKeyScroll: true, // Captures scrolling using the arrow and page up/down keys regardless of page focus. When off, defers to default browser scrolling behavior. enableLinkIcon: true, // Controls the visibility of the link icon + enableCrossOrigin: true, // if enabled images on diva canvas will have crossOrigin = "anonymous" enableNonPagedVisibilityIcon: true, // Controls the visibility of the icon to toggle the visibility of non-paged pages. (Automatically hidden if no 'non-paged' pages). enableSpaceScroll: false, // Scrolling down by pressing the space key enableToolbar: true, // Enables the toolbar. Note that disabling this means you have to handle all controls yourself. diff --git a/source/js/image-request-handler.js b/source/js/image-request-handler.js index fa122e40..f3952b8a 100644 --- a/source/js/image-request-handler.js +++ b/source/js/image-request-handler.js @@ -22,7 +22,10 @@ function ImageRequestHandler(options) { // Initiate the request this._image = new Image(); - this._image.crossOrigin = "anonymous"; + if (options.enableCrossOrigin) + { + this._image.crossOrigin = "anonymous"; + } this._image.onload = this._handleLoad.bind(this); this._image.onerror = this._handleError.bind(this); this._image.src = options.url; diff --git a/source/js/renderer.js b/source/js/renderer.js index 4b4ff6f7..fbcbb01f 100644 --- a/source/js/renderer.js +++ b/source/js/renderer.js @@ -21,6 +21,7 @@ function Renderer(options, hooks) this._viewport = options.viewport; this._outerElement = options.outerElement; this._documentElement = options.innerElement; + this._enableCrossOrigin = options.enableCrossOrigin; this._hooks = hooks || {}; @@ -287,6 +288,7 @@ Renderer.prototype._initiateTileRequests = function(pages) newPendingRequests[source.url] = new ImageRequestHandler({ url: source.url, timeoutTime: REQUEST_DEBOUNCE_INTERVAL, + enableCrossOrigin: this._enableCrossOrigin, load: function (img) { delete this._pendingRequests[source.url]; diff --git a/source/js/viewer-core.js b/source/js/viewer-core.js index 7b979e98..7bba5688 100644 --- a/source/js/viewer-core.js +++ b/source/js/viewer-core.js @@ -404,7 +404,8 @@ function ViewerCore(element, options, publicInstance) var options = { viewport: viewerState.viewport, outerElement: viewerState.outerElement, - innerElement: viewerState.innerElement + innerElement: viewerState.innerElement, + enableCrossOrigin: settings.options.enableCrossOrigin }; var hooks = {