AJAX 可以使用 HTTP 或 HTTPS 之外的协议吗?
我想知道 AJAX 是否可以使用 HTTP 或 HTTPS 之外的协议。
I wonder if AJAX can use protocols other than HTTP or HTTPS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我想知道 AJAX 是否可以使用 HTTP 或 HTTPS 之外的协议。
I wonder if AJAX can use protocols other than HTTP or HTTPS.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
Ajax 意味着 XMLHttpRequest。正如您不必将 XML 与 XHR 一起使用一样,您也不必使用 HTTP。
来自 W3C XMLHttpRequest 规范(添加了重点):
HTTP 和 HTTPS 之外的可用协议都是非标准化的,因此它们取决于您所使用的特定环境1。也就是说,所有兼容的 XHR 实现都必须支持 HTTP 和 HTTPS,但不要求支持任何其他特定协议。这意味着您可能会发现 Internet Explorer 支持
1例如哪个版本的浏览器(Safari、Firefox、Chrome、IE vs Opera) vs...),或者哪种服务器端实现(V8 vs Rhino vs...)
Ajax means XMLHttpRequest. Just as you don't have to use XML with XHR, you also don't have to use HTTP.
From the W3C XMLHttpRequest spec (emphasis added):
The available protocols beyond HTTP and HTTPS are non-standardized, so they depend on the specific environment1 you're using. That is, all compliant XHR implementations must support HTTP and HTTPS, but are not required to support any other specific protocols. That means that you might find that Internet Explorer supports
1Such as, which version of which browser (Safari vs Firefox vs Chrome vs IE vs Opera vs...), or which server-side implementation (V8 vs Rhino vs...)
XMLHttpRequest (XHR) 是可用于 Web 浏览器脚本语言(例如 JavaScript)的 API。它用于向 Web 服务器发送 HTTP 或 HTTPS 请求并将服务器响应数据加载回脚本中。
来自维基百科
XMLHttpRequest (XHR) is an API available to web browser scripting languages such as JavaScript. It is used to send HTTP or HTTPS requests to a web server and load the server response data back into the script.
from wikipedia