假设我的web服务器是 www.aaa.com
我服务器的某个页面有ajax写的动态取其他网站页面数据的代码, function showlog(szLog){
szLog = "[" + Date() + "]:" +szLog + "\n";
txt.value = szLog + txt.value;
}function getObjXMLReq()
{
var objXMLReq;
//for Mozilla and Safari etc.
if (window.XMLHttpRequest){
objXMLReq = new XMLHttpRequest();
}
// IE5 for the mac claims to support window.ActiveXObject, but throws an error when it's used
else if (window.ActiveXObject && !(navigator.userAgent.indexOf('Mac') >= 0 && navigator.userAgent.indexOf("MSIE") >= 0)){
objXMLReq = new ActiveXObject("Microsoft.XMLHTTP");
}
return objXMLReq;
}function adReq() {
var objXMLReq = getObjXMLReq();
showlog("getObjXMLReq");
if(!objXMLReq){
return;
}
var url = "http://www.bbb.com/index";
objXMLReq.open("GET", url, false);
objXMLReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ret = objXMLReq.responseText;
showlog(ret);
}但是失败了,请问要如何改?
我服务器的某个页面有ajax写的动态取其他网站页面数据的代码, function showlog(szLog){
szLog = "[" + Date() + "]:" +szLog + "\n";
txt.value = szLog + txt.value;
}function getObjXMLReq()
{
var objXMLReq;
//for Mozilla and Safari etc.
if (window.XMLHttpRequest){
objXMLReq = new XMLHttpRequest();
}
// IE5 for the mac claims to support window.ActiveXObject, but throws an error when it's used
else if (window.ActiveXObject && !(navigator.userAgent.indexOf('Mac') >= 0 && navigator.userAgent.indexOf("MSIE") >= 0)){
objXMLReq = new ActiveXObject("Microsoft.XMLHTTP");
}
return objXMLReq;
}function adReq() {
var objXMLReq = getObjXMLReq();
showlog("getObjXMLReq");
if(!objXMLReq){
return;
}
var url = "http://www.bbb.com/index";
objXMLReq.open("GET", url, false);
objXMLReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ret = objXMLReq.responseText;
showlog(ret);
}但是失败了,请问要如何改?
支持option请求以对请求进行验证。ie6 - ie7可以用Flash来做,也需要对方配置
正确的crossdomain.xml