Making Desktop Webapps in Lion

“By the sainted mustache of Charles Foster Kane! Is it ever hot out there! I should write an app that keeps my city’s Current Weather data from Weather Underground within easy view at all times!”

“Holy rosemary vinaigrette! Today promises to be a huge day of news for Apple! I need to keep an eye on the news from all day today! But there’s no such app for that particular function, dagnabbit!”

“Jumping prophets of Newton Lower Falls! I’m getting far too much work done today! If I don’t find a way to distract myself, I’ll set unreasonably-high expectations of how much work I’ll be expected to accomplish on a Friday! If only there was a way to keep the Adorable Baby Polar Bears Live Webcam on my screen at all times!”

If you’re running Snow Leopard, you’re doomed to a dull life of unmet expectations. At best, you’re at the mercy of third-party developers and their infernal expectation to actually be paid for the apps they write.

In Lion? It’s DIY all the way. Automator — that singularly-awesome utility and infrastructure for automating damned-near any task — has a new feature that allows you to open any webpage inside a popup window. It’s so easy to use and it’s so goddamned useful that I’m amazed it’s not being promoted.

Here’s the incredibly complicated procedure for building an app that keeps a webpage open in a floating window:

1) Launch Automator.

2) Create a new App. (Or a Workflow. But an App will be cooler because you can have it in the Launchpad and start it up with a single click.)

3) Find and drag the “Get Specified URLs” action into your workflow. Just type the name into the search box until Automator finds it for you.

4) Paste in the URL of the site you want to view.

5) Find and drag the “Website Popup” action into the workflow. Choose a size for the window.

6) Save. Done.

Your workflow will look like this:

And when you run the app, it’ll put up a popup window that looks like this:

It’s a real app. It’ll stick around and float above your other windows until you dismiss it. You can move it into other Spaces and do pretty much whatever you want with it.

Did you notice the Really Clever Thing the “Website Popup” does? You can specify the size of the popup window and you can also choose how the app will identify itself to the website. In this example, the “User Agent” has been set to “iPhone.” Which means that thought this app was an iPhone web browser, and it automatically delivered the compact edition of the site.

It’s a little like the “Web Clippings” feature of Dashboard. Except this isn’t Dashboard, so there’s actually a chance in hell that you’ll ever use this thing.

The less-snarky thing to say is that this tool integrates into your mainstream Mac workspace far better, and its definable User Agent setting means that you can get it to work with the far more useful mobile editions of your most useful sites. It’s particularly keen for webcams. A friend recently set up a webcam for his pet birds. As a Dashboard Web Clipping, I’d have to carefully adjust the clip size and then I’d have to be in Dashboard to actually use it. I also couldn’t share this with other people. As an Automator app, it’s two quick steps, it runs alongside my other apps, and any time my friend wants to share the webcam with someone, he can just email them the app.

I think the Automator team at Apple has two mandates. The first one, of course, is to give every Mac user more power and control over how they do things, to save everybody time, and to restore the sort of volksprogramming experience that the Mac community lost when Apple terminated HyperCard.

But the self-appointed mandate is to keep emphasizing the truly cool things that you can do with this utility. With each new OS release, there comes at least one new Automator action that I play with for a while and then think “I can’t believe I built something that does this in that little amount of time!


“Is it possible to ask the user for a URL first?” asks @Thomas. That’s a nifty idea: instead of locking the app to just open, you could make a general-purpose “Open this URL as an iPhone webapp” utility.

And yes, of course, it’s easy-peasy. Instead of hard-coding the URL into the “Get Specified URLs” action, just add an action that asks for text input from the user and then feed that into an action that extracts a URL from any given text. That’ll dump the URL into the next function and Bob’s yer uncle. Viz:

The app will present the user with a standard dialog and then it’ll open the URL.

It’s yet another testament to how deep Automator goes. You rarely get tripped up by the problem “All of the basic functions are there but alas, there’s one critical element missing so no, you can’t do that.” And later on, it’s always easy to adapt or extend a workflow to accommodate a new idea or a change in needs.

Edited again:

A Trusted Advisor on Automator informs me of a cool Automator shortcut: if you drag a URL proxy (from your browser’s address bar) into the editing window Automator automatically builds you a “Get Specified URLs” action, using that URL.

97 thoughts on “Making Desktop Webapps in Lion

  1. Dennis Wurster

    “It’s a little like the “Web Clippings” feature of Dashboard. Except this isn’t Dashboard, so there’s actually a chance in hell that you’ll ever use this thing.”

    It’s funny because it’s true! I built a weather-widget for to show me the hourly temperatures for the day, and I never use it because I never bother to launch Dashboard.

  2. bill

    I tried it with touch arcade, it worked, until I put it into iPhone mode then it gave me a blank page.

  3. masklinn

    @john: no you could not, because the “Website Popup” action is not built into Automator’s 10.6 libraries. You could open a page in the default web browser, not make them into semi-standard applications. Unless you’d built the “website popup” action yourself via a webview of course, which was always possible I guess

  4. Topher

    Your brilliance is only outmatched by your sideburns.

    Unfortunately, it’s too hot to upgrade to Lion. I’m still chillin’ with Snow Leopard.

  5. KiltBear

    I <3 U

    This IS really cool. A super mini SSB.

    See also for something a little more full featured.

    BTW, I think since expose, spaces, and dashboard are all bundled up now, I'm actually using dashboard. One little button for everything!

  6. Jackson

    Neat idea, Andy. I use a SSB (“Single Site Browser”) app on my Mac, called “Fluid” which lets you create single website “applications”. The applications it creates will behave as first class citizens in Mac OS X, come with an icon that appears in the dock, some sites even get dock badges (to show email counts for gmail, etc) and lots of other neat things.

    CAVEAT, this is NOT an advertisement. I’m just a user ;)

    The free version works great, but there’s a pay version with some enhanced features, like embedding an app into the menubar, fullscreen, etc. The normal version comes with a ton of other cool features too.

    As a side-note:
    Dashboard widgets can be dragged to the desktop (but they will hover on top of everything).

    Enter this into the terminal:
    “defaults write devmode YES”
    and logout and back in

    Then switch to the dashboard, click and hold on a widget, press the dashboard key on your keyboard, to return to the desktop and the widget will with you. You can then drag it somewhere and drop it (release the click).

    Google “dashboard widget on desktop” to get a better explanation. I’ve been doing this since 10.4

  7. Johnny

    You could use the “Ask for text” action before the “Get Specified URLs” action.

  8. Pingback: Making Desktop Web Apps in Lion | Reader

  9. Pingback: The Greatest Feature of Lion You Aren't Using

  10. Chris Sawyer

    1.) This is great

    2.) I grew up near Newton Lower Falls. (Although truthfully, more towards Newton Upper Falls – within walking distance of Hemlock Gorge. )

  11. Alan

    OK, how about a button in the Safari tool bar that pops open the current site in this fashion.

  12. Will Porter

    This is indeed very neat. Thanks for describing this, Andy (and thanks to John Gruber for linking to it)!

    But I have a question. The Get Specified URLs action lets you enter more than one URL; but as far as I can tell, it will only open the first URL in the list. Is there a way to get the app to open two URLs (say, with a tabbed UI)? If not, what’s the point of letting me enter multiple URLs?

  13. Allen Robel

    I just tried something similar which seems pretty useful. Create a Service instead of a workflow.

    Then, select “Service recieves URLs” from “Any Application. Next drag the Website Popup under it. Save as e.g. “Display URL in Popup” and then right-click on a highlighted URL, and select “Display URL in Popup” from the Services context menu.

    Works like a charm!

  14. Philippe Martin

    It’s not new in Lion. I’ve been using it in SnowLeopard for ages (although the action was updated in Lion and is not comptible with the SL version).

  15. Alex Gibson

    Nice – but currently does not support HTML5 localStorage when you close and re-open a created app :-(

    Also, regular javaScript alert() dialogs appear to be supressed.

  16. Randy

    I remember doing this in SL too. I think I may have had to download the website popup though. I think I got it from that semi-official? automator site. The one that Sal recommends.

    My question to you guys though is:
    Can you change the surrounding chrome? I wanna try making it like the new white chrome in Lion’s Quick Look.

    This is very handy if you have a lot of tabs open in your suspended browsing session and you don’t want to open them all up just to look at one little link.

  17. Mark Hernandez

    @Dennis Wurster… Yeah, I sure miss HyperCard. But HyperCard still lives in the form of LiveCode (runrev dot com) with the same HyperTalk language, same HyperCard editing environment, and you can even save stacks to full on apps for MacOS, Windows and Linux and make iOS and Android apps too. It’s based on MetaCard. (I used to sell XCMDs for both HyperCard and SuperCard.)

    I use it to quickly make miscellaneous functionality I need without the unnecessary complexity of Objective-C and Xcode (but interestingly, I use it in support of my Mac OS app development.) Check it out.

    Automator and AppleScript have things about them which feel like it throws stones in your path and stops you cold, even with AppleScript books on hand. A lot to be said for dead-simple things. There are tradeoffs with every tool, and it’s good to have things like LiveCode and Automator for the quick and dirty.

  18. Kevin

    Dayum. Until just now I wasn’t excessively disappointed that my old iMac won’t run Lion. Thanks, Andy…

  19. Hamranhansenhansen

    > If I could build Hypercard-style
    > stacks on my iPad for my own
    > personal use, I’d be really happy

    Your nostalgia is sweet, but HyperCard (1987, Mac) was made obsolete by something called the World Wide Web (1990, NeXT), which is in your iPad. You put your cards and links on a server instead of on your local computer, and then others can read them and link to them and you can link to their cards, too, no matter what computing platform everyone is using. So there is nothing stopping you from building your cards and links (HyperCard) on your iPad. If you have a Facebook page, you’re already done.

  20. Pingback: Web apps on your desktop | AI NO TENSHi

  21. John Rosata

    Holy crap. I live in Newton Lower Falls! Does this mean that I am, or know a prophet?

  22. Justin Freid

    This is a nice feature in Lion, thank you for finding it and displaying the instructions clearly. Maybe someone will provide an Automator template for download.
    You’ve also been able to drag Dashboard Widgets into your regular desktop since 10.4:

  23. Pingback: Desktop Web App Example In Lion |

  24. Herman

    For my personal workflow, I’m really curious to find out if one can pass a variable to a script *inside* of the web page just opened. That would open up a LOT of possibilities :)

  25. Mike

    On a brighter note, thanks for getting me to play with Automator again. I had forgotten its awesome power.

  26. Pingback: Maak Desktop WebApps in OSX Lion – Video uitleg |

  27. Pingback: pinboard July 23, 2011 —

  28. chrisjniles

    @Jeffrey van der Goot

    Yes, there is a way to replace Otto as the icon for these little apps you’ve created, and this will work with any file (you can have custom icons for specific folders for example.

    The easy way is to select the app in question and Get Info (cmd-i). You may not have noticed that you can actually select the icon in the Get Info window. Just copy the graphic you would like to use (if it’s a picture file like .png or .jpg you can just copy it from the finder) and then paste it onto the icon in the Get Info window. There’s no step 3 ;-)

Comments are closed.