Preview (or "Validate") URL in Pop-Up Browser Window (without activating browser)

This macro solved a minor irritation for me which was that I wanted to be able to quickly pop up a preview of a URL without opening up a new browser tab/window. I just hate clutter...

So, for example I'm reading the headlines on the Times website and I just want to quickly scan an article. I right click on a hyperlinked article (a headline) and copy the link:

Then using a hotkey I invoke a pop-up web page which displays the URL which is now on the clipboard (with scrolling and much of the ordinary functionality of Safari).

The macro is sending the clipboard URL to a simple Automator app called "Preview URL App" which I placed in the Applications folder. The app is easy to make (and you can download it here):

Once the pop-up browser materializes, the macro sends a mouse-click dead center of the screen, thus hitting the center of the pop-up (presumably), so that the pop-up is brought to the front. (For some reason, it is not at the front when it pops up). That way, it can easily be dismissed with the Escape key or by hitting the Cancel button.

The macro can be downloaded here, and it looks like this:

Of course, you can invoke the pop-up preview anytime you have a URL in the clipboard!



And ... one can invoke this macro from Launchbar by creating a new, and very simple, LB action in the Action Editor (see related post here) --

-- which runs a simple Applescript:

tell application "Keyboard Maestro Engine" do script "URL Preview" end tell

I love LB, and use it many times a day. But I have not seen the utility in running KM macros from it, since I can always use the KM Trigger Macro by Name, or my favorite, @DanThomas’ macro:
MACRO: Execute Macro by Name (Spotlight)

I think its perceived utility depends on how one uses either app and how one’s muscle memory works, and what one’s preferences are. For example, I like triggering a palette of macros from Launchbar, rather than a keyboard shortcut that I sometimes forget. I can hunt for it on Launchbar. I also like redundancy in methods of accessing an action.

1 Like

I store many links in .md files as bookmarks instead of in the browser so I can better search and organize them. I find this macro extremely helpful.

Thank you for creating this.

1 Like

I am gratified you have found this useful. I use it many times a day myself, e.g., to preview a URL in an email, etc. Incidentally, I also use Pinboard to store links I don't want to save in the browser's bookmarks. You can tag the links for easy retrieval. It's a great service. To get the links quickly into Pinboard with tags from the browser, I use Spillo. You can still use Preview URL macro to quickly check out the links you've saved. :wink:


Just chiming in to say thank you for this. I'm still learning KM and now I can do some more magic :grin:

1 Like

You can do this very easily without any third party app using the Custom Floating HTML Prompt action (requires KM version 10).

Here's a basic example which assumes you have already copied the URL into the clipboard:

Preview URL.kmmacros (2.1 KB)

(You can obviously tweak this to adjust the size of the preview and its position on the screen. )


Thanks for this. To clarify, my macro does not use a third party app; just a simple Automator workflow saved as an app.

1 Like

I had no idea you could do this - thanks. And it's something I wanted to do, so it's very cool. I see that @macdevign_mac had code like this in a different topic, so I'm not sure who came up with it first (not that it matters), but thanks to both of you. :slight_smile:

Question: What's the purpose of "KMHandleSchemes"? I mean, I read the Wiki entry, but I still don't understand what it accomplishes.

1 Like

Ha, just tried, and it works wonders. Thanks a bunch!

Slightly off-topic, but I ask anyway: does anyone happen to know how to apply some adblocking or cleaning to these floating HTML windows? I'm always in my highly cleaned-up browsing bubble and forgot what the 'real' internet looks like out there :eyes:

1 Like

I didn’t realise that, but having seen the quality of his posts here my guess is I wasn’t the first :smiley:

Having had a look around, I think the credit for the code above should go to @macdevign_mac, @mrpasini, and @Zabobon for the discussion in this thread

1 Like

Probably newbie question again but still:

  1. I'm currently using an Automator app to Get Contents of Clipboard > Extract URLs from Text, and using it as input to this macro. I'm sure there's a (simple) way to do it fully in KM but I have yet to find out. Any idea please?

  2. I'm having this pop-up when the floating windows appear. Where to look and how to debug?

Thanks in advance.

Visit the KM thread I linked to above and you’ll find the solution to that in post #14 and subsequent ones.

Since this is a new question you should post it to a new topic.

Before I suggest a solution can you show an example of what’s in the clipboard that you wish to extract URLs from?

I just copied the link of this discussion to test.

Not a new question, rather a question from a newbie/noob :slight_smile:
But I've been tweaking it since then, and it seems stable so far.
Thank you for your help.

In that case why do you need to use Automator when the only thing in the clipboard is the URL?

You're right, I've disabled the Automator action and the macro works without it.
It was something I picked last night while messing around and trying to achieve this.
All is fine now.