Automator in Lion (11.7, 2011) introduced a fascinating action: Website Popup. What it does is open a standalone web viewer given a URL. I find Website Popups to be particularly useful for reference sites such as those documenting an API, especially those in the Apple Developer Library which have their own navigation mechanism (in particular, using a table of contents on the left).
Download this workflow and move it to ~/Library/Workflows
:
WebsitePopup.workflow.zip (20.9 KB)
Then import Website Popups v. 1.3.kmmacros (2.0 MB), which contains:
- a macro for calling the workflow; it takes a URL as a parameter and creates a Website Popup for that URL
- a bunch of preconfigured macros which call that macro for websites likely to be of interest to readers of this forum
The group shows the macros as a palette for one action when activated by a hot key. The submacro is the last item on the palette â selecting that gives you the opportunity to specify a URL to be opened.
Details
The website popup may be closed by typing Escape or clicking Cancel. It may also be closed by clicking OK, in which case selected text gets put on the System Clipboard. The popup stays on top of regular windows, like a Help page, which has both advantages and disadvantages. There may be more than one popup active at a time.
Navigation of a pageâs links is particularly fast. â„ââ goes to the previous page visited, and â„ââ to the next. Other than that, there are no tabs, history, bookmarks, or anything else you would see in a real browser.
The Website Popup action has some customizations. Adjust the details of the Open Website Popup action to your liking. The width was chosen to conform to the expected width of many of the Apple documentation sites. (I am not sure whether there are system settings that might affect how wide the window will be relative to its contents.)
Display Arbitrary HTML
I named the macro group âWebsite Popupsâ because thatâs what Automator calls them. Actually, though, they may be used for an existing file (HTML, PDF, plain text, etc.) or one constructed by a program or macro. (See, for instance, Creating a Web/HTML Page with AppleScript or JXA -- Suggestions?, for which a website popup might be useful.) A program or macro could construct a file â perhaps in /tmp
â and open it with the Open Website Popup macro or a variation on its last action. Remember to use file://
instead of http://
when opening files.
Website Popup Applications
You can create a double-clickable Open Website Popup application by adding a Get Specified URLs action before the Website Popup step and specifying the URL you want to use. The process will appear in Activity Monitor under the name of the application, and it is an application process of System Events. However, it will not appear on the dock, or any kind of application switcher.
Failed Efforts
I tried programming something like this in Swift and Objective-C, but didnât get very far, partly because of the confusion caused by Appleâs replacement of WebView with WKWebView in 10.10.
I also tried customizing the window size for each website, but couldât find a way to do it. I canât even see a way to give the popup focus when it first opens. (One hack I did try, but rejected as too random and inaccurate, was to execute an asynchronous macro that clicked the mouse where the popup popped up.)
Automatorâs documentation of the Website Popup action claims that its input is one or more URLs, but I wasnât able to get multiple URLs to work.
Background
The contents of this post, the workflow, and the macro is based on information derived from quite a few web sites, so I am not citing any, which I would otherwise do. A Google search on "website popup" will find many of them. Some of particulars of website popups described above were discovered by experimentation.