Skip to content

Instantly share code, notes, and snippets.

@robflaherty
Created April 26, 2010 13:55
Show Gist options
  • Save robflaherty/379356 to your computer and use it in GitHub Desktop.
Save robflaherty/379356 to your computer and use it in GitHub Desktop.
/*
* Bookmarklet for viewing source in iPad Safari
*/
javascript:(function(){
var w = window.open('about:blank'),
s = w.document;
s.write('<!DOCTYPE html><html><head><title>Source of ' + location.href + '</title><meta name="viewport" content="width=device-width" /></head><body></body></html>');
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));
})();
@allmarkedup
Copy link

Hi Rob, just came across this and thought you may be interested in something I've recently put together called 'Snoopy' - it is a mobile safari bookmarklet that (like this) allows you to view the generated source of a page but also the raw source and it also pulls out some other page info into a 'at-a-glance' overview.

You can find it here: http://snoopy.allmarkedup.com/

It's early days and it still needs a lot of work so any feedback you have would be very welcome!

@robflaherty
Copy link
Author

Awesome work! It looks really nice. Going to try it out on my iPad now. =)

@TechXcell
Copy link

Great work bud! So simple and elegant! Love it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment