可以通过端Ajax HTTP和HTTPS工作的一面呢?可以通过、工作、HTTP、Ajax

2023-09-10 20:17:19 作者:唯有时光能治愈

假设使用AJAX对所有服务器的交互,是有可能使用HTTP的常规数据传输,然后切换到安全的数据传输AJAX方式HTTPS请求通过HTTP访问最初的单个页面的应用程序?

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?

如果是这样,如何​​将浏览器处理证书和锁定通知时,一个HTTPS AJAX请求是?

If so, how would the browser handle the certificate and locking notification when a HTTPS AJAX request was made?

如果这是不可能的,那么有没有什么解决方法在同一页面内混合AJAX HTTP和HTTPS AJAX例如加载一个iFrame的HTTPS?

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?

谢谢!

推荐答案

试图切换协议将违反的同源策略。

Attempting to switch protocols will violate the same origin policy.

我不知道如何使用iFrame中一个解决方法是行为,但我认为浏览器可能会阻止访问被加载HTTPS框架,也是因为同根同源的政策。

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.