htmlhttp-refererscript-tagreferrer-policy

Strip out referers from script src


I'm doing a remote script-src

<script src="http://thirdparty.com/test.js"></script>

I don't want to send my http referer headers to thirdparty.com. How do I do it?


Solution

  • You would have to proxy the request for the script through your own server. For example:

    <script src="stripreferrer.php?url=http%3A%2F%2Fthirdparty.com%2Ftest.js"></script>
    

    Then, your server-side code would make the HTTP request sans referrer code, and pass the response to the client.