You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
To try the demo on local computer, I download openseadragon and this demo, and highsmith tile image folders, and all the js files needed from the demo website. Then I replace the code in index.html by the dynamic code in the browser for the demo website.
Then I change all the http path in js and html to local file, and specify the viewer object in demo,js and demo-bundle.js as below:
If I remove/comment the line: crossOriginPolicy: 'Anonymous'
then I open index.html and could see exactly the loaded image and filter options. But once I click an filter, although the filter was added to the lower part, but the image turns black forever. The console explorer said:
Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.
at Object.tileDrawingHandler [as handler] (file:///D:/QMDownload/9/test3/OpenseadragonDemo/_plugins/demo-bundle.js:45407:57)
at file:///D:/QMDownload/9/test3/OpenseadragonDemo/_plugins/demo-bundle.js:28662:34
at $.Viewer.raiseEvent (file:///D:/QMDownload/9/test3/OpenseadragonDemo/_plugins/demo-bundle.js:28684:14)
at _drawingHandler (file:///D:/QMDownload/9/test3/OpenseadragonDemo/_plugins/demo-bundle.js:43338:23)
at $.Tile.drawCanvas (file:///D:/QMDownload/9/test3/OpenseadragonDemo/_plugins/demo-bundle.js:40996:10)
at $.Drawer.drawTile (file:///D:/QMDownload/9/test3/OpenseadragonDemo/_plugins/demo-bundle.js:41659:23)
at drawTiles (file:///D:/QMDownload/9/test3/OpenseadragonDemo/_plugins/demo-bundle.js:44495:29)
at updateViewport (file:///D:/QMDownload/9/test3/OpenseadragonDemo/_plugins/demo-bundle.js:43944:6)
at $.TiledImage.draw (file:///D:/QMDownload/9/test3/OpenseadragonDemo/_plugins/demo-bundle.js:43390:10)
at $.World.draw (file:///D:/QMDownload/9/test3/OpenseadragonDemo/_plugins/demo-bundle.js:45070:29)
As others have said you are "tainting" the canvas by loading from a cross origins domain.
https://developer.mozilla.org/en-US/docs/HTML/CORS_Enabled_Image
However, you may be able to prevent this by simply setting:
img.crossOrigin = "Anonymous";
This only works if the remote server sets the following header appropriately:
Access-Control-Allow-Origin "*"
The Dropbox file chooser when using the "direct link" option is a great example of this. I use it on oddprints.com to hoover up images from the remote dropbox image url, into my canvas, and then submit the image data back into my server. All in javascript
So I bring back the crossOriginPolicy: 'Anonymous' in demo,js and demo-bundle.js, but found that when I open index.html, the image was total black.
How can I solve the problem and make the filter work in local computer ?
Thanks.
The text was updated successfully, but these errors were encountered:
Hi
To try the demo on local computer, I download openseadragon and this demo, and highsmith tile image folders, and all the js files needed from the demo website. Then I replace the code in index.html by the dynamic code in the browser for the demo website.
Then I change all the http path in js and html to local file, and specify the viewer object in demo,js and demo-bundle.js as below:
If I remove/comment the line:
crossOriginPolicy: 'Anonymous'
then I open index.html and could see exactly the loaded image and filter options. But once I click an filter, although the filter was added to the lower part, but the image turns black forever. The console explorer said:
I googled and find an answer that
https://stackoverflow.com/questions/22097747/how-to-fix-getimagedata-error-the-canvas-has-been-tainted-by-cross-origin-data
So I bring back the
crossOriginPolicy: 'Anonymous'
in demo,js and demo-bundle.js, but found that when I open index.html, the image was total black.How can I solve the problem and make the filter work in local computer ?
Thanks.
The text was updated successfully, but these errors were encountered: