Hacking Gmail

(Grace) #1

56 Part II — Getting Inside Gmail


First, open up a directory on a website. You’ll need to access it via a proper
domain, you see. Create the directory, and make sure your browser can see it. In
that directory, place a text file, called Listing.txt, and put the exclamation
“Horrible!” inside the file. Bear with me.

Then create an HTML file, containing the code in Listing 5-1, and save this file
to the directory you created earlier.

Listing 5-1: Listing.html — Showing XMLHttpRequest

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>
<head>
<style></style>
<script type=”text/javascript”>

var xmlhttp=false;

try {
xmlhttp = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch (e) {
try {
xmlhttp = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch (E) {
xmlhttp = false;
}
}

if (!xmlhttp && typeof XMLHttpRequest!=’undefined’) {
xmlhttp = new XMLHttpRequest();
}

function Listing1() {
xmlhttp.open(“GET”, “Listing.txt”,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.responseText)
}
}
xmlhttp.send()
}

</script>
</head>

<body>

<h1>My Dog Has No Nose.</h1>
Free download pdf