Jac*_*eam 7 xmlhttprequest google-chrome-extension google-apps-script
阅读XMLHttpRequest以在Google Chrome扩展程序中使用,我遇到了一个问题.
MDN指定使用 XMLHttpRequest.addEventListener
,而Google XMLHttpRequest.onreadystatechange
在其示例中使用.
在向Google Apps脚本发出GET请求时,这两种方法之间是否存在偏好?我是异步Javascript的新手,在此之前我刚刚在GAS工作.
首选项是浏览器兼容性.来自MSN上的XMLHttpRequest API文档.
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties
onreadystatechange
作为XMLHttpRequest
实例的属性在所有浏览器中都受支持.
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Events
除了将属性设置为处理函数之外,更新的浏览器(包括Firefox)还支持
XMLHttpRequest
通过标准addEventListener
API 监听事件on*
.
由于Apps Script Web Apps很快将仅支持现代浏览器(因为本机和模拟模式已被折旧),您可以使用其中任何一种.
归档时间: |
|
查看次数: |
4740 次 |
最近记录: |