OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 function log(message) | 4 function log(message) |
5 { | 5 { |
6 var item = document.createElement("li"); | 6 var item = document.createElement("li"); |
7 item.appendChild(document.createTextNode(message)); | 7 item.appendChild(document.createTextNode(message)); |
8 document.getElementById("console").appendChild(item); | 8 document.getElementById("console").appendChild(item); |
9 } | 9 } |
10 | 10 |
11 function return_malware_prefetch() { | 11 function return_malware_prefetch() { |
12 var pathArray = window.location.pathname.split('/'); | 12 var pathArray = window.location.pathname.split('/'); |
13 var newPathname = ""; | 13 var newPathname = ""; |
14 for ( i=0; i < pathArray.length - 1; i++ ) { | 14 for ( i=0; i < pathArray.length - 1; i++ ) { |
15 newPathname += pathArray[i]; | 15 newPathname += pathArray[i]; |
16 newPathname += "/"; | 16 newPathname += "/"; |
17 } | 17 } |
18 newPathname += "malware.html"; | 18 newPathname += "malware.html"; |
19 var href = window.location.protocol + "//" + window.location.host + newPathn ame; | 19 var href = window.location.protocol + "//" + window.location.host + newPathn ame; |
20 var link = document.createElement("link"); | 20 var link = document.createElement("link"); |
21 link.rel = "prefetch"; | 21 link.rel = "prerender"; |
cbentzel
2011/05/24 03:11:07
Doesn't this test also want to stay as "prefetch"
gavinp
2011/05/24 13:02:52
Yes. Done.
| |
22 link.href = href; | 22 link.href = href; |
23 log(link.outerHTML); | 23 log(link.outerHTML); |
24 return link; } | 24 return link; } |
25 | 25 |
26 function add_prefetch(element) { | 26 function add_prefetch(element) { |
27 var head = document.getElementsByTagName("head")[0]; | 27 var head = document.getElementsByTagName("head")[0]; |
28 head.appendChild(element); | 28 head.appendChild(element); |
29 } | 29 } |
30 </script> | 30 </script> |
31 </head> | 31 </head> |
32 <body onload="add_prefetch(return_malware_prefetch());"> | 32 <body onload="add_prefetch(return_malware_prefetch());"> |
33 This page is not malware, <a href="malware.html">but this page is</a>. If | 33 This page is not malware, <a href="malware.html">but this page is</a>. If |
34 prefetches don't trigger safe browsing interstitials, then this page | 34 prefetches don't trigger safe browsing interstitials, then this page |
35 should work in a dandy manner. | 35 should work in a dandy manner. |
36 <p><ol id="console"></ol></p> | 36 <p><ol id="console"></ol></p> |
37 </body> | 37 </body> |
38 </html> | 38 </html> |
OLD | NEW |