Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/468.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
重定向后IE中的Javascript document.referer为空_Javascript_Internet Explorer - Fatal编程技术网

重定向后IE中的Javascript document.referer为空

重定向后IE中的Javascript document.referer为空,javascript,internet-explorer,Javascript,Internet Explorer,我正在链接到一个页面(第1页),该页面对最终页面(第2页)执行重定向。但在第2页上,document.referer属性为空,但由于重定向,仅在I.E中为空 有办法解决这个问题吗 谢谢 货车 --编辑--- 页面A仅作为指向页面B的链接。页面B使用window.location重定向到页面C的url。但如前所述,从页面B重定向后,页面C中的document.referer属性为空,这仅是中的情况,即 另外-我只使用http而不是https,这似乎是IE的一个缺陷,请参见: 如果是IE,请创建指向

我正在链接到一个页面(第1页),该页面对最终页面(第2页)执行重定向。但在第2页上,document.referer属性为空,但由于重定向,仅在I.E中为空

有办法解决这个问题吗

谢谢 货车

--编辑---

页面A仅作为指向页面B的链接。页面B使用window.location重定向到页面C的url。但如前所述,从页面B重定向后,页面C中的document.referer属性为空,这仅是中的情况,即


另外-我只使用http而不是https,这似乎是IE的一个缺陷,请参见:
如果是IE,请创建指向该url的新链接,然后单击它

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

如何重定向?是否从“http:”重定向到“https:”?在这种情况下,答案是否定的。通常,“referer”属性根本不可靠,应该避免将其用于任何重要功能。请尝试location.href而不是window.location来执行重定向。