HTML5 CORS 中事件处理程序的示例
跨源资源共享 (CORS) 是一种机制,用于允许 Web 浏览器中的另一个域的受限资源
例如,如果你在 html5 演示部分中单击 HTML5 视频播放器。它将请求相机权限。如果用户允许该权限,则它只会打开相机,否则它不会为 Web 应用程序打开相机。
以下是 CORS 中事件处理程序的示例
xhr.onload = function() {
var responseText = xhr.responseText;
// process the response.
console.log(responseText);
};
xhr.onerror = function() {
console.log('There was an error!');
};
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
JavaScript
PHP