Later, I checked some relevant information and found that it is impossible to obtain HTTP_REFERER in IE through window.location.href or in IE. I really don’t understand IE browsers. Many browsers run very well, but they just don’t support them. In the end, there is no way. I can only fake the source HTTP_REFERER method or use JS to forge it.
The HTTP_REFERER submission that IE can recognize is an event triggered by click or a request submitted by a Form form. The following is a method summarized based on online information:
<script>function referURL(url){var isIe=(document.all)?true:false;if(isIe) {var linka = document.createElement('a');linka.href=url;document.body.appendChild(linka);linka.click();}else window.location = url;}var url=”//www.VeVB.COM”;referURL(url);</script>This method first uses document.all to determine whether the current browser is IE. If so, generate a link, and then automatically execute the onclick event. If not, use JS to jump. In this way, you can get HTTP_REFERER when processing the page
This method is tested in IE, Firefox, Safari, Chrome
2. PHP uses curl to forge IP and origin HTTP Referrer
referer.php
<?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "http://mydomain.com/ip.php");curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:8.8.8.8', 'CLIENT-IP:8.8.8.8')); //Construct IPcurl_setopt($ch, CURLOPT_REFERER, "//www.VeVB.COM/ "); //Construct the origin curl_setopt($ch, CURLOPT_HEADER, 1);$out = curl_exec($ch);curl_close($ch);echo $out;ip.php
<?phpfunction getClientIp() {if (!empty($_SERVER["HTTP_CLIENT_IP"]))$ip = $_SERVER["HTTP_CLIENT_IP"];else if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];else if (!empty($_SERVER["REMOTE_ADDR"]))$ip = $_SERVER["REMOTE_ADDR"];else$ip = "err";return $ip;}echo "IP: " . getClientIp() . "<br>";echo "referer: " . $_SERVER["HTTP_REFERER"];