Lion added the ability to Quick Look a URL in an application (like Mail.app). I would like to use that functionality from a script.

Is that possible?


There is also an Automator action for displaying a website in a Quick Look like window:

automator -i http://apple.com Desktop/Website\ Popup.workflow


Yes, it is possible, but not directly from the internet. The file needs to be downloaded first.

qlmanage -p '/path/to/file'

will show the quick look preview for that file. It will also write some debug information to stderr, so I usually append >/dev/null 2>&1 to the end of the command.

In your case, you will need to download the file first in order to get to the Quick Look preview. You also need the proper extension for qlmanage to recognize the file. cd ~/tmp; curl "$url" --O "quicklook.$extension" will download it into ~/tmp (this directory needs to exist) and you will need to set the extension beforehand with extension=${url##*.}.

The final shell script:

cd ~/tmp
curl "$url" --O "quicklook.$extension"
qlmanage -p "quicklook.$extension"

And in an applescript:

set quicklookurl to "http://images.apple.com/mac/home/images/hero_30years_then.jpg"
do shell script "cd ~/tmp; url=" & quoted form of quicklookurl & "; extension=${url##*.}; curl \"$url\" --O \"quicklook.$extension\"; qlmanage -p \"quicklook.$extension\""
  • But this will probably break on most complex web pages. – Fuzzy76 Jul 25 '18 at 13:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .