Ajax HTTP 和 HTTPS 可以并行工作吗?
假设最初通过 HTTP 访问的单页应用程序使用 AJAX 进行所有服务器交互,是否可以使用 HTTP 进行常规数据传输,然后切换到 AJAXian HTTPS 请求进行安全数据传输?
如果是这样,当发出 HTTPS AJAX 请求时,浏览器将如何处理证书和锁定通知?
如果这是不可能的,那么是否有任何解决方法可以在同一页面中混合 AJAX HTTP 和 AJAX HTTPS,例如加载 HTTPS 的 iFrame?
谢谢!
Assuming a single page application accessed initially via HTTP that uses AJAX for all server interaction, is it possible to use HTTP for regular data transfers and then switch to AJAXian HTTPS requests for secure data transfers?
If so, how would the browser handle the certificate and locking notification when a HTTPS AJAX request was made?
If this is not possible, then are there any workarounds to mixing AJAX HTTP and AJAX HTTPS within the same page such as loading an iFrame for HTTPS?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试切换协议将违反同源政策。
我不确定使用 iFrames 的解决方法会如何表现,但我认为浏览器可能会阻止对作为 HTTPS 加载的框架的访问,这也是由于同源策略。
Attempting to switch protocols will violate the same origin policy.
I am not sure how a workaround using iFrames would behave, but I think the browser may block access to the frame that was loaded as HTTPS, again due to the same origin policy.
我知道这是旧帖子,但由于我是通过搜索引擎到达这里的,所以值得分享我所学到的东西。
可以使用名为 CORS 的东西,但像往常一样,旧的 MSIE 有问题实现它。
它应该很简单,就像发送额外的 HTTP 标头一样:
I know this is old post but since i arrived here by search engine it would be a worth to spill what I've learn.
It is possible to use something called CORS but as usual old MSIE has problem implementing it.
It should be simple as sending additional HTTP headers: