The purpose of setting the referrer is to determine whether to include the original website's URL when redirecting to an external domain. By default, browsers include the URL when redirecting to an external website, so by default, external websites can trace the originating website. However, this can be disabled by setting the referrer.
Add code
// No referrer sent for all requests // Referrer sent for same-origin requests
Reference documents:https://www.w3.org/TR/2017/CR-referrer-policy-20170126/#referrer-policies
enum ReferrerPolicy { "", "no-referrer", "no-referrer-when-downgrade", "same-origin", "origin", "strict-origin", "origin-when-cross-origin", "strict-origin-when-cross-origin", "unsafe-url" };
Empty stringno-referrer No referrer is sent for any requests.no-referrer-when-downgrade By default, no referrer is sent when making an HTTPS to HTTP request.same-origin Requests from the same origin will send a referrer.origin It will be sent, but only the protocol and domain information will be sent.strict-origin It will send the referrer, but only the protocol and domain information. Referrers will not be sent for HTTPS to HTTP requests.origin-when-cross-origin Requests from the same origin will send a referrer; requests from different origins will only send the protocol and domain information.strict-origin-when-cross-origin Requests from the same origin will send a referrer; HTTPS to HTTP requests will not send a referrer; otherwise, only the origin information will be sent.unsafe-url Send referrer at any timeThere are four possible methods:
Referrer-Policy: origin<meta>To change the Referrer Policy of an element, simply modify the content named "referrer". <meta name="referrer" content="origin"><a>, <area>, <img>, <iframe>, or<link>Setting the referrerpolicy attribute of an element <a href="http://example.com" referrerpolicy="origin"><a>, <area>, <link>The element sets the link relationship of rel. <a href="http://example.com" rel="noreferrer"><meta name="referrer" content="no-referrer"> At that time, statistics from Baidu Analytics, CNZZ, and other sources will become invalid.<meta name="referrer" content="no-referrer">To avoid tracing the origin of the product downstream.