I was pretty stoked when Chris shared a way to “View Source” on mobile. Sure, it’s not the same as a built-in feature but it allows iOS users like myself a way to peek at a site’s code the same way folks on Android can by prepending
view-source: to a URL.
I was curious what sorts of dev-related tools might be baked right into my iPhone, so I dug around. It’s actually a perfect time to do that with iOS 15 fresh out of the oven and all.
The iOS Shortcuts app might be the most underrated app of all. It’s sorta like IFTTT or Zapier for iOS in that you get these hooks you can play around with to make one app respond to another and do things. Like dim the lights in my house when Marvin Gaye hits the HomePod. Useful stuff like that.
And guess what? Turns out there are a few pre-made Shortcuts recipes that can be useful for front-end developers. And you can grab them right in the Shortcuts app’s Gallery.
View source (for realzzz)
Of course, there’s a pre-fab shortcut to view the source of any webpage.
Now, when I’m on a webpage, I can ask Siri to view source, or open the Share Sheet to trigger the shortcut.
This would be perfect if we have line numbers, syntax highlighting, a mono font (seriously!), zooming, and… OK, maybe it’s far from perfect.
Grab all the images on a page
This is another Shortcuts gem. Open a webpage and ask Siri to “get images from page.” Now, I’m no fan of scraping assets off webpages, especially in bulk, but not all image collection has to be nefarious.
How fun is this?! Someone had the idea to create a shortcut that opens the current page in the Wayback Machine to see past versions.
I actually think this one is legitimately useful. Say you want to test content in a design and want to see exactly how it looks on mobile. This shortcut basically drops
contenteditable on every element on the page.
That’s all! Again, all of these are available right in the iOS Shortcuts app in the Gallery tab. Maybe there are others. Or maybe someone’s made a cool shortcut to share with the rest of us. 😉
I use the following bookmarklet, which opens up a new tab with the source of the current page:
The problem with the shortcut is that it can’t access the current page’s DOM, so it makes another request which could be different to the actual page you’re debugging.
I also use Eruda, which has a console, network and DOM browser. It was ported to a web extension with the release of iOS 15, which makes it a bit more convenient:
How I get these shortcuts?
They’re available right in the Shortcuts app, in the Gallery tab.
Try inspect browser. It can do all of that and more.