Created
November 5, 2014 18:10
-
-
Save promediacorp/c7e8c373371426e27954 to your computer and use it in GitHub Desktop.
HTML file for Googlebot Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>Test Page</title> | |
<style> | |
body { | |
margin: 40px; | |
font-size: 16px; | |
font-family: "Helvetica Neue", sans-serif; | |
} | |
.blue { | |
color: blue; | |
} | |
.red { | |
color: red; | |
} | |
.purple { | |
color: purple; | |
} | |
.green { | |
color: green; | |
} | |
</style> | |
<script> | |
function addPara(text, classname) { | |
var para = document.createElement("p"); | |
var node = document.createTextNode(text); | |
para.className = classname; | |
var thebody = document.getElementById("thebody") | |
para.appendChild(node); | |
thebody.appendChild(para); | |
} | |
function showMoreOnLoad() { | |
addPara("Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people's hats off—then, I account it high time to get to sea as soon as I can.", "red"); | |
} | |
function showMore() { | |
addPara("This is my substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship.", "green"); | |
} | |
function showMoreAjaxOnLoad() { | |
var xhr = new XMLHttpRequest(); | |
var url = '/moby'; | |
xhr.open('GET', url, true); | |
xhr.onload = function(e) { | |
addPara(this.response, "purple"); | |
} | |
xhr.send(); | |
} | |
function showMoreAjax() { | |
var xhr = new XMLHttpRequest(); | |
var url = '/moby2'; | |
xhr.open('GET', url, true); | |
xhr.onload = function(e) { | |
addPara(this.response, "blue"); | |
} | |
xhr.send(); | |
} | |
</script> | |
</head> | |
<body onload="showMoreOnLoad(); showMoreAjaxOnLoad();" id="thebody"> | |
<a href="#" onclick="showMore();">Insert Text (in body)</a> | |
<br> | |
<a href="#" onclick="showMoreAjax();">Insert Text (from AJAX)</a> | |
<br>Color scheme: | |
<br><span class="red">red = inserted onLoad</span> | |
<br><span class="blue">blue = inserted via AJAX</span> | |
<br><span class="purple">purple = both (onload, via AJAX)</span> | |
<br><span class="green">green = inserted via JS in body</span> | |
<p id="p1">Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation.</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment