ajax 302 浏览器能放问,AJAX:301/302头部重定向(跨域)在某些Webkit浏览器中失败...

试图通过302从一台服务器重定向到另一台没有内容的服务器,仅用于跟踪目的,我担心会丢失一些使用Apple iOS设备的访问者, Webkit/Chrome浏览器。AJAX:301/302头部重定向(跨域)在某些Webkit浏览器中失败

HTTP/1.1 302 Moved Temporarily

Date: Tue, 26 Mar 2013 20:00:03 GMT

Server: Apache/2.2.3 (Red Hat)

X-Powered-By: PHP/5.2.6

Expires: Tue, 03 Jul 2001 06:00:00 GMT

Last-Modified: Tue, 26 Mar 2013 20:00:03 GMT

Cache-Control: no-store

Pragma: no-cache

P3P: CP="STP CUR OUR"

x-own: 46.163.123.40

Access-Control-Allow-Origin: *

Access-Control-Allow-Credentials: true

Location: http://target2.com

Connection: close

Content-Type: text/html; charset=iso-8859-1

在Firefox和IE上,重定向是可以的。从domainA重定向到domainA也是可以的。跨域重定向失败Webkit的/镀铬/移动Safari浏览:-(

JavaScript代码段看起来是这样的:

testRedirection=function(url)

{

var xmlhttp = null;

if (window.XMLHttpRequest)

xmlhttp=new XMLHttpRequest();//ff,webkit

else if (window.ActiveXObject)

xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");//ie

if(xmlhttp)

{

xmlhttp.open("HEAD",url,true);//tried HEAD, GET, POST

xmlhttp.onreadystatechange=function(){

if(xmlhttp.readyState==4)

{

if(xmlhttp.status==200 || (xmlhttp.status>200 && xmlhttp.status<400))

alert("arrived with status "+xmlhttp.status);

else

alert("failed with status "+xmlhttp.status);

};

};

xmlhttp.send();

};

//\

};

不管怎么说,iPhone和iPad设备和Chrome,我记录的流量,并将其也从未与target2.com到达,停止没有错误或警告。

这只是发生跨域重定向头,是否有额外的头允许这样做?

2013-04-03

ledy

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值