- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / referrer_policy / referrer-policy-start.html
1 <html>
2 <head>
3 <script>
4 function run() {
5   var kPolicy = 1;
6   var kPort = 2;
7   var kSslPort = 3;
8   var kRedirect = 4;
9   var kLink = 5;
10   var kTarget = 6;
11   var re = new RegExp(
12       /policy=(.*)&port=(.*)&ssl_port=(.*)&redirect=(.*)&link=(.*)&target=(.*)/);
13   var matches = re.exec(document.location.search);
14
15   if (matches == null) {
16     document.body.innerText = "Could not parse parameters!";
17     return;
18   }
19
20   var meta = document.createElement("meta");
21   meta.name = "referrer";
22   meta.content = matches[kPolicy];
23   document.head.appendChild(meta);
24
25   var destination;
26
27   if (matches[kRedirect] == "true") {
28     destination =
29         "https://127.0.0.1:" + matches[kSslPort] + "/server-redirect?" +
30         "http://127.0.0.1:" + matches[kPort] + "/files/referrer-policy-log.html";
31   } else {
32     destination =
33         "http://127.0.0.1:" + matches[kPort] + "/files/referrer-policy-log.html";
34   }
35
36   if (matches[kLink] == "true") {
37     var link = document.createElement("a");
38     link.innerText = "link";
39     link.target = matches[kTarget];
40     link.href = destination;
41     document.body.appendChild(link);
42   } else {
43     document.location = destination;
44   }
45 }
46 </script>
47 </head>
48 <body onload="run()">
49 </body>
50 </html>