Extract links from src script
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.
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.