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/

Filed under: code snippets

what's hot

Flickr Photos

Tree graffiti

Tree graffiti

Tree graffiti

More Photos

Sponsor Mike run the Bath Half marathon

mikek on twitter