24.07.2017 Views

Hacking Gmail

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

56 Part II — Getting Inside <strong>Gmail</strong><br />

First, open up a directory on a website. You’ll need to access it via a proper<br />

domain, you see. Create the directory, and make sure your browser can see it. In<br />

that directory, place a text file, called Listing.txt, and put the exclamation<br />

“Horrible!” inside the file. Bear with me.<br />

Then create an HTML file, containing the code in Listing 5-1, and save this file<br />

to the directory you created earlier.<br />

Listing 5-1: Listing.html — Showing XMLHttpRequest<br />

<br />

<br />

<br />

<br />

<br />

var xmlhttp=false;<br />

try {<br />

xmlhttp = new ActiveXObject(“Msxml2.XMLHTTP”);<br />

} catch (e) {<br />

try {<br />

xmlhttp = new ActiveXObject(“Microsoft.XMLHTTP”);<br />

} catch (E) {<br />

xmlhttp = false;<br />

}<br />

}<br />

if (!xmlhttp && typeof XMLHttpRequest!=’undefined’) {<br />

xmlhttp = new XMLHttpRequest();<br />

}<br />

function Listing1() {<br />

xmlhttp.open(“GET”, “Listing.txt”,true);<br />

xmlhttp.onreadystatechange=function() {<br />

if (xmlhttp.readyState==4) {<br />

alert(xmlhttp.responseText)<br />

}<br />

}<br />

xmlhttp.send()<br />

}<br />

<br />

<br />

<br />

My Dog Has No Nose.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!