亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - echart images are exported to iframe, cross-site occurs
怪我咯
怪我咯 2017-05-19 10:33:19
0
1
616

I want to export echart’s exported image to an iframe, but a cross-domain error occurs. How should I fix it? Use the myChart.getDataURL() method provided by echart.

怪我咯
怪我咯

走同樣的路,發(fā)現(xiàn)不同的人生

reply all(1)
PHPzhong

Usually, pictures allow cross-domain access, and cross-domain pictures can also be used in canvas, but doing so will pollute the canvas. Once the canvas is polluted, its data will not be read. For example, toBlob(), toDataURL() or getImageData() method.
This security mechanism of the browser avoids the risk of misuse of remote server images without permission.
So if you need to use cross-domain image resources in canvas, please refer to the following apache configuration snippet

<IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
        <FilesMatch "\.(cur|gif|ico|jpe?g|png|svgz?|webp)$">
            SetEnvIf Origin ":" IS_CORS
            Header set Access-Control-Allow-Origin "*" env=IS_CORS
        </FilesMatch>
    </IfModule>
</IfModule>

echart itself uses canvas technology. Cross-domain cross-domain is caused by the canvas security mechanism. It is recommended to change the image source.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template