开发者

Same origin policy javascript

开发者 https://www.devze.com 2022-12-20 04:41 出处:网络
I\'m writing an NPAPI plugin that injects a script with a src located 开发者_Go百科at my server. After the injection, my plugin tries to call a function in the script. But this doesnt seem to work. I

I'm writing an NPAPI plugin that injects a script with a src located 开发者_Go百科at my server. After the injection, my plugin tries to call a function in the script. But this doesnt seem to work. I think the reason is the same origin policy, but im not sure how to overcome it.

The call to the function works if i inject the script code completely into the page from the plugin. The only situation it doesnt work is when i give a src and keep the script in my server.


NPAPI plugins are not limited by origin policies, AFAIK, but you may want to keep in mind that injecting the script tag into the body will not synchronously load the javascript file; you'll have to wait a bit before you'll be able to access it. I would guess that this is most likely your problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消