HTTP Header referer mainly tells people where I came from, which is to tell people which page I came from, which can be used to count the source of users who access this website, and can also be used to prevent theft link. The best way to get this thing is js. If it is obtained on the server side (PHP method such as: $_SERVER['HTTP_REFERER']) is unreliable, it can be forged, but it is best to use js to get it, it is difficult for others to forge it.
Method: Use js' document.referer method to accurately judge the true origin of the web page. Currently, Baidu statistics, Google ads statistics, and CNZZ statistics are all used. Anti-theft chain is also very simple. If you judge the origin of the URL in JS, you will not display the pictures if it is not for this website.
As we all know, we web developers hate IE browser because IE does not support standards, and the default behavior outside the standards is often inconsistent with other browsers:
Use javascript to do jumps in IE, for example, use window.location.href = ""; if you use document.referrer, google cannot get the HTTP referrer requested by the browser because IE has cleared
Other mainstream browsers Firefox and Chrome will retain referrer, there is no way, which means IE will enjoy the special treatment of "ministerial level" again:
The following code can solve this problem of ie:
//If it is an ie browser, manually add a referer
This principle is to secretly add a link to the page of the IE browser, and then click the link automatically, so the referrer can be retained.
The code copy is as follows:
var url = '//www.VeVB.COM';
if (/MSIE (/d+/./d+);/.test(navigator.userAgent) || /MSIE(/d+/./d+);/.test(navigator.userAgent))
{
var referLink = document.createElement('a');
referLink.href = url;
document.body.appendChild(referLink);
referLink.click();
}
else
{
location.href = url;
}