开发者

Javascript document.referrer empty in IE after redirect

开发者 https://www.devze.com 2023-03-15 09:09 出处:网络
I\'m linking to a page (page1) which performs a redirect the final page (page2). But on page 2 the document.referrer property is empty but only in I.E because of the redirect.

I'm linking to a page (page1) which performs a redirect the final page (page2). But on page 2 the document.referrer property is empty but only in I.E because of the redirect.

Is there a way to solve this?

Thanks Van

--开发者_如何转开发Edit---

Page A simply as a link to Page B. Page B uses window.location to redirect to the url for Page C. But as stated the document.referrer property is empty in Page C after the redirect from Page B this is only the case in I.E.

Also - I am only using http not https


It seems to be a bug of IE, see: http://webbugtrack.blogspot.com/2008/11/bug-421-ie-fails-to-pass-http-referer.html
If it's IE, create a new link to that url, then click it.

function goto(url){
  if(isIE){
    var referLink = document.createElement('a');
    referLink.href = url;
    document.body.appendChild(referLink);
    referLink.click();    
  }
  else{
      location.href = url;
  }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消