when jquery comes from CDN, are ajax calls cross-origin?

时光怂恿深爱的人放手 提交于 2019-12-24 16:53:02

问题


I've recently started delegating to a CDN-hosted jquery, forgetting about my ajax calls being impacted by CORS -- oops. Surprisingly, we haven't seen browsers making much fuss about it! Specifically, as far as we can tell only one particular browser does a preflight OPTIONS (the agent is "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0"). Vast majority of browsers out there, including Chrome, FF or Safari are perfectly happy without the preflight -- one of the reasons why we didn't catch the problem in development/testing, that our OPTIONS request handling was lacking.

Please confirm if this scenario does in fact constitute CORS:

  • file: app.js from Host-A
  • file: jquery.js from CDN

app.js makes ajax-calls to its place of origin (Host-A) using jquery from CDN. Is IE11 the only one doing it right by issuing the preflight?

Thanks!


回答1:


All ajax-calls have the origin Host-A. They have the origin of the domain of the original html document.



来源:https://stackoverflow.com/questions/27366200/when-jquery-comes-from-cdn-are-ajax-calls-cross-origin

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