加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

AJAX可以使用HTTP或HTTPS以外的协议吗?

发布时间:2020-12-16 03:07:59 所属栏目:百科 来源:网络整理
导读:我想知道AJAX是否可以使用HTTP或HTTPS以外的协议. Ajax意味着 XMLHttpRequest.正如您不必将XML与XHR一起使用,您也不必使用HTTP. Despite its name, XMLHttpRequest can be used to retrieve any type of data,not just XML,and it supports protocols other
我想知道AJAX是否可以使用HTTP或HTTPS以外的协议.
Ajax意味着 XMLHttpRequest.正如您不必将XML与XHR一起使用,您也不必使用HTTP.

Despite its name,XMLHttpRequest can be used to retrieve any type of data,not just XML,and it supports protocols other than HTTP (including file and ftp).

从W3C XMLHttpRequest spec开始(重点补充):

The XMLHttpRequest object implements an interface exposed by a scripting engine that allows scripts to perform HTTP client functionality,such as submitting form data or loading data from a server. It is the ECMAScript HTTP API.

The name of the object is XMLHttpRequest for compatibility with the Web,though each component of this name is potentially misleading. First,the object supports any text based format,including XML. Second,it can be used to make requests over both HTTP and HTTPS (some implementations support protocols in addition to HTTP and HTTPS,but that functionality is not covered by this specification). Finally,it supports “requests” in a broad sense of the term as it pertains to HTTP; namely all activity involved with HTTP requests or responses for the defined HTTP methods.

HTTP和HTTPS之外的可用协议是非标准化的,因此它们取决于您正在使用的特定环境1.也就是说,所有兼容的XHR实现必须支持HTTP和HTTPS,但不需要支持任何其他特定协议.这意味着您可能会发现Internet Explorer支持

1,例如,哪个版本的浏览器(Safari vs Firefox vs Chrome vs IE vs Opera vs …),或者哪个服务器端实现(V8 vs Rhino vs …)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读