ie下,php HTTP_REFERER獲取失敗的整理
HTTP_REFERER有效的情況 1、以iframe 形式調用地址 2、以window.open調用,打開新頁面window.open(url); 3、使用window.location.replace在Firefox 和Chrome下可以獲取HTTP_REFERER window.location.replace(url); 4、使用window.location.href在Firefox 和Chrome下可以獲取HTTP_REFERER window.location.href = url; 5、使用A標籤跳轉可以獲取HTTP_REFERER HTTP_REFERER無效的情況 1、使用函數 file_get_contents或file等函數調用URL地址,這個地址所在的文件無法獲取HTTP_REFERER 2、使用window.location.replace在IE6、IE7、IE8下無法獲取HTTP_REFERER window.location.replace(url); 3、使用window.location.href在IE6、IE7、IE8下無法獲取HTTP_REFERER window.location.href = url; 解決方法,在ie下,js跳轉使用如下方法:
1 function gotoUrl(url){2 var gotoLink = document.createElement('a');3 4 gotoLink .href = url;5 6 document.body.appendChild(gotoLink);7 8 gotoLink .click();9 }
完美解決~~