I'm trying to get the image of Map from openlayersOpenLayers 4.6.5 and the following error is appearingappearing each and every time.
I'm using cdn link of openlayersOpenLayers 4.6.5 for the base Map in java-scriptJavaScript with Apache tomcatTomcat server in web-Application application (httpHTTP format) everything is working fine.
But when I start to get the image from openlayersOpenLayers Map it's giving :SecurityError: The operation is insecure.
SecurityError: The operation is insecure.
in case of FireFox
and
Uncaught DOMException: Failed to execute 'toBlob' on 'HTMLCanvasElement': Tainted canvases may not be exported.
Uncaught DOMException: Failed to execute 'toBlob' on 'HTMLCanvasElement': Tainted canvases may not be exported.
It's really head eating and I have tried many ways like corsCORS, timeout and anything available from other sources:
canvas.toBlob(function(blob)
{
var imgData = new Image();
imgData.setAttribute('crossOrigin', 'anonymous');
imgData.src = canvas.toDataURL('png');
}
I found out something like (I'm not sure) : it's due to security of the network i.e I'm using secure cdn link from openlayersOpenLayers :https://cdnjs.cloudflare.com/ajax/libs/openlayers/4.6.5/ol.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/4.6.5/ol.js
which is https://https://
and my application is http://http://
---- is this a problem? I'm really tired of this.
Could anyone look into it and it would be the great help honestly.?