12 var re = new RegExp("policy=(.*)&port=(.*)&ssl_port=(.*)&redirect=(.*)&" +
13 "link=(.*)&target=(.*)");
14 var matches = re.exec(document.location.search);
16 if (matches == null) {
17 document.body.innerText = "Could not parse parameters!";
21 var meta = document.createElement("meta");
22 meta.name = "referrer";
23 meta.content = matches[kPolicy];
24 document.head.appendChild(meta);
28 if (matches[kRedirect] == "false") {
29 destination = "http://127.0.0.1:" + matches[kPort] +
30 "/files/referrer-policy-log.html";
31 } else if (matches[kRedirect] == "http") {
32 destination = "http://127.0.0.1:" + matches[kPort] +
33 "/server-redirect?http://127.0.0.1:" + matches[kPort] +
34 "/files/referrer-policy-log.html";
35 } else if (matches[kRedirect] == "echoheader") {
36 destination = "http://127.0.0.1:" + matches[kPort] + "/echoheader?Referer";
38 destination = "https://127.0.0.1:" + matches[kSslPort] +
39 "/server-redirect?http://127.0.0.1:" + matches[kPort] +
40 "/files/referrer-policy-log.html";
43 if (matches[kLink] == "true") {
44 var link = document.createElement("a");
45 link.innerText = "link";
46 link.target = matches[kTarget];
47 link.href = destination;
48 document.body.appendChild(link);
50 document.location = destination;