I do not want to send my...">

Extract links from src script

I am making a remote script -src

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

I do not want to send my HTTP link headers to thirdparty.com. How to do it?

+4
source share
3 answers

You will have to proxy the request for the script through your own server. For instance:

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

Then your server-side code will make an HTTP request without a referrer code and pass the response to the client.

+5
source

The answers have been deprecated since 2013: you can do this by setting the referrer policy on your web page. For example, if you have

<meta name="referrer" content="origin">

on your page, then any resources <script src="..."> , extracted from this page (after this line), send only source, rather than the full URL. Other options include a no-referrer.

See http://caniuse.com/#feat=referrer-policy for acceptance status by browsers: as of September 2016, it is supported by most major non-IE browsers. This old Mozilla security blog blog post may be worth a read if you prefer not to read the standard.

+3
source

This is part of the HTTP protocol. You cannot control this with HTML or JavaScript.

+2
source

Source: https://habr.com/ru/post/1497104/


All Articles