| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script> |
| 4 var pageWasPrerendered = false; |
| 5 |
| 6 // Make sure plugin was not loaded while prerendering. |
| 7 function DidPrerenderPass() { |
| 8 pageWasPrerendered = true; |
| 9 return true; |
| 10 } |
| 11 |
| 12 // Make sure DidPrerenderPass() was called first. Otherwise, the page was |
| 13 // most likely reloaded instead of using the prerendered page. |
| 14 function DidDisplayPass() { |
| 15 return pageWasPrerendered; |
| 16 } |
| 17 |
| 18 function xhr_post() { |
| 19 var xhr; |
| 20 try { xhr = new ActiveXObject('Msxml2.XMLHTTP'); } |
| 21 catch (e) { |
| 22 try { xhr = new ActiveXObject('Microsoft.XMLHTTP'); } |
| 23 catch (e2) { |
| 24 try { xhr = new XMLHttpRequest(); } |
| 25 catch (e3) { xhr = false; } |
| 26 } |
| 27 } |
| 28 |
| 29 xhr.onreadystatechange = function() { |
| 30 if(xhr.readyState == 4) { |
| 31 if(xhr.status == 200) { |
| 32 document.getElementById("dynamic").innerHTML = |
| 33 "Received:" + xhr.responseText; |
| 34 } else { |
| 35 document.getElementById("dynamic").innerHTML = |
| 36 "Error code: " + xhr.status; |
| 37 } |
| 38 } |
| 39 }; |
| 40 xhr.open("POST", "prerender_xhr_post.html", true); |
| 41 xhr.setRequestHeader("Content-Type", "text/plain"); |
| 42 xhr.send("test"); |
| 43 } |
| 44 |
| 45 xhr_post(); |
| 46 </script> |
| 47 </head> |
| 48 <body> |
| 49 <div id="dynamic"> |
| 50 Waiting for XHR response. |
| 51 </div> |
| 52 </body> |
| 53 </html> |
| OLD | NEW |