I am mikek's Blog

The personal blog of Mike Karthauser, who you may know from Brightstorm Limited or the internet.

Viewing html source in mobile Safari on iPad and iPhone

A neat bit of javascript which allows you to view html source on an iPad or iPhone.


javascript:(function(){
var w = window.open('about:blank'),
s = w.document;
s.write('Source of ' + location.href + '');
s.close();

var pre = s.body.appendChild(s.createElement("pre"));
pre.style.overflow = 'auto';
pre.style.whiteSpace = 'pre-wrap';
pre.appendChild(s.createTextNode(document.documentElement.innerHTML));
})();

Just copy and save as a bookmarklet on mobile safari.

All credit for this goes to Rob Flaherty at Ravel Rumba.

For more details and a link to the bookmarklet – visit http://www.ravelrumba.com/blog/ipad-view-source-bookmarklet/

Advertisements

Filed under: code snippets

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

mikek on twitter

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

%d bloggers like this: