<!DOCTYPE html>
<html>
<head>
<script>
function done() {
const kPolicy = 1;
// Set the document's referrer policy given the query param.
const re = new RegExp("policy=(.*)");
const matches = re.exec(document.location.search);
const referrer_policy = matches[kPolicy];
const meta = document.createElement('meta');
meta.name = 'referrer';
meta.content = referrer_policy;
document.head.appendChild(meta);
// Set the link's `href` attribute.
document.getElementById("link").href = "/redirect?https://www.a.test:" + location.port + "/echoreferrer";
}
</script>
</head>
<body onload="done()">
<a id="link">link</a>
</body>
</html>