当jquery来自CDN时,ajax调用是否来自跨域? [英] when jquery comes from CDN, are ajax calls cross-origin?

查看:159
本文介绍了当jquery来自CDN时,ajax调用是否来自跨域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始委托CDN托管的jquery,忘记了我的ajax调用受CORS影响 - 哎呀。令人惊讶的是,我们还没有看到浏览器对此大做文章!具体来说,据我们所知,只有一个特定的浏览器会进行预检OPTIONS(代理是Mozilla / 5.0(Windows NT 6.3; WOW64; Trident / 7.0; rv:11.0)。大多数浏览器都在那里,包括Chrome ,没有预检,FF或Safari非常高兴 - 我们没有在开发/测试中发现问题的原因之一是我们的OPTIONS请求处理缺乏。

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.

请确认这种情况是否确实构成了CORS:

Please confirm if this scenario does in fact constitute CORS:


  • 文件:来自Host-A的app.js

  • 文件:来自CDN的jquery.js

app.js对其原产地进行ajax调用(Host- A)使用来自CDN的jquery。IE11是唯一通过发布预检来做到这一点吗?

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?

谢谢!

推荐答案

所有ajax调用都有源Host-A。它们具有原始html文档域的来源。

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

这篇关于当jquery来自CDN时,ajax调用是否来自跨域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆