“Cross-Origin Resource Sharing policy” Between Subdomains in JS?

烈酒焚心 提交于 2019-12-12 03:34:42

问题


I have a Tumblr theme that includes a canvas script.
The Cross-Origin Resource Sharing policy doesn't allow context.getImageData() to work. Script is located at user.tumblr.com,
images are located at static.tumblr.com.

Is there any solution for this?

Thank you!


回答1:


document.domain will be your friend there.

I haven't studied the canvas security model closely, but if it follows the rest of Javascript, setting

document.domain = tumblr.com

might help.

(Googling for document.domain canvas may lead to more.)



来源:https://stackoverflow.com/questions/14474194/cross-origin-resource-sharing-policy-between-subdomains-in-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!