是在chrome扩展程序里用,我在manifest.json中添加了
"permissions": [ "tabs", "http://*/", "https://*/" ]
按文档的意思,这样就应该允许跨域访问了代码是这样
xmlHttp = new XMLHttpRequest();
xmlHttp.open("get", "http://taobao.com", false);
xmlHttp.send();
var result=xmlHttp.responseText;上面的代码总提示a network error occurred,
但我把 taobao.com改成 baidu.com完全没有问题,上面的提示是为什么呢正确的写法是怎么样的?
"permissions": [ "tabs", "http://*/", "https://*/" ]
按文档的意思,这样就应该允许跨域访问了代码是这样
xmlHttp = new XMLHttpRequest();
xmlHttp.open("get", "http://taobao.com", false);
xmlHttp.send();
var result=xmlHttp.responseText;上面的代码总提示a network error occurred,
但我把 taobao.com改成 baidu.com完全没有问题,上面的提示是为什么呢正确的写法是怎么样的?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货