I wonder if AJAX can use protocols other than HTTP or HTTPS.
我想知道AJAX是否可以使用HTTP或HTTPS以外的协议。
2 个解决方案
#1
8
Ajax means XMLHttpRequest. Just as you don't have to use XML with XHR, you also don't have to use HTTP.
Ajax表示XMLHttpRequest。就像您不必在XHR中使用XML一样,您也不必使用HTTP。
Despite its name,
XMLHttpRequest
can be used to retrieve any type of data, not just XML, and it supports protocols other than HTTP (includingfile
andftp
).尽管它的名称,XMLHttpRequest可用于检索任何类型的数据,而不仅仅是XML,它支持HTTP以外的协议(包括文件和ftp)。
From the W3C XMLHttpRequest spec (emphasis added):
从W3C XMLHttpRequest规范(重点添加):
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.
XMLHttpRequest对象实现脚本引擎公开的接口,该脚本引擎允许脚本执行HTTP客户端功能,例如提交表单数据或从服务器加载数据。它是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.
对象的名称是XMLHttpRequest,用于与Web兼容,但此名称的每个组件都可能具有误导性。首先,该对象支持任何基于文本的格式,包括XML。其次,它可以用于通过HTTP和HTTPS发出请求(除HTTP和HTTPS之外,某些实现还支持协议,但此规范未涵盖该功能)。最后,它支持广义上的“请求”,因为它与HTTP有关;即涉及HTTP请求或定义的HTTP方法的响应的所有活动。
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
HTTP和HTTPS之外的可用协议是非标准化的,因此它们取决于您正在使用的特定环境1。也就是说,所有兼容的XHR实现必须支持HTTP和HTTPS,但不需要支持任何其他特定协议。这意味着您可能会发现Internet Explorer支持
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...)
1,例如,哪个版本的浏览器(Safari vs Firefox vs Chrome vs IE vs Opera vs ...),或者哪个服务器端实现(V8 vs Rhino vs ...)
#2
-4
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.
XMLHttpRequest(XHR)是一种可用于Web浏览器脚本语言(如JavaScript)的API。它用于将HTTP或HTTPS请求发送到Web服务器,并将服务器响应数据加载回脚本。
from wikipedia
来自*
#1
8
Ajax means XMLHttpRequest. Just as you don't have to use XML with XHR, you also don't have to use HTTP.
Ajax表示XMLHttpRequest。就像您不必在XHR中使用XML一样,您也不必使用HTTP。
Despite its name,
XMLHttpRequest
can be used to retrieve any type of data, not just XML, and it supports protocols other than HTTP (includingfile
andftp
).尽管它的名称,XMLHttpRequest可用于检索任何类型的数据,而不仅仅是XML,它支持HTTP以外的协议(包括文件和ftp)。
From the W3C XMLHttpRequest spec (emphasis added):
从W3C XMLHttpRequest规范(重点添加):
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.
XMLHttpRequest对象实现脚本引擎公开的接口,该脚本引擎允许脚本执行HTTP客户端功能,例如提交表单数据或从服务器加载数据。它是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.
对象的名称是XMLHttpRequest,用于与Web兼容,但此名称的每个组件都可能具有误导性。首先,该对象支持任何基于文本的格式,包括XML。其次,它可以用于通过HTTP和HTTPS发出请求(除HTTP和HTTPS之外,某些实现还支持协议,但此规范未涵盖该功能)。最后,它支持广义上的“请求”,因为它与HTTP有关;即涉及HTTP请求或定义的HTTP方法的响应的所有活动。
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
HTTP和HTTPS之外的可用协议是非标准化的,因此它们取决于您正在使用的特定环境1。也就是说,所有兼容的XHR实现必须支持HTTP和HTTPS,但不需要支持任何其他特定协议。这意味着您可能会发现Internet Explorer支持
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...)
1,例如,哪个版本的浏览器(Safari vs Firefox vs Chrome vs IE vs Opera vs ...),或者哪个服务器端实现(V8 vs Rhino vs ...)
#2
-4
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.
XMLHttpRequest(XHR)是一种可用于Web浏览器脚本语言(如JavaScript)的API。它用于将HTTP或HTTPS请求发送到Web服务器,并将服务器响应数据加载回脚本。
from wikipedia
来自*