Help with %FrontBrowserTitle% and %FrontBrowserURL%?

Hello all. I was hoping for some help using the above two tokens. My task is to capture this data into KM variables, pop up a dialog using them, and then action the results.

Here is a snippet of the macro:

What I am finding is that on one computer I have testing it on, I reliably get the URL and Title of the active tab of the front window (note that interestingly, the URL works even if I don't enable Javascript in Apple Events in the Safari Debug menu, but the Title is only returned when Javascript is enabled, but either way it works).

On a second computer, I always get the Title and URL of the SAME tab, no matter what tab is actually the front tab.

I have tried quitting the KM engine and user interface and restarting and quitting Safari and restarting it; no change in behavior.

I have also tried rebooting the computers; no difference.'

I have also replaced %FrontBrowser{Title,URL}% with %Safari{Title,URL}% and found no change in behavior either (and the same for Chrome).

This seems an odd bug, and I have no idea where to go from here. I looked at the KM engine log, no information that helps there.

I have no idea why it works just fine on one computer and fails on the other. Both are running Catalina 10.15.4. If relevant, the one on which it works is an iMacPro; the one where it fails is the 16" MBP.

Thanks for any suggestions!

The FrontBrowserURL token is working, so Keyboard Maestro (editor) has Automation permissions for accessing the front browser.

However the FrontBrowserTitle token is failing. That probably means that the browser does not have Allow JavaScript from AppleEvents enabled. Chrome & Safari both disable this by default and it stops Keyboard Maestro from accessing the contents of web pages even when it can talk to the web browser via AppleScript.

...and two years later the million dollar question - how do I: "Allow JavaScript from AppleEvents enabled" - I've done a search of both the forum and ... in the end I found: assistance:Allow JavaScript From Apple Events [Keyboard Maestro Wiki] which effectively told me to enable the developer menu.

A suggestion if I may - update the documentation for the tokens - FrontBrowserTitle, Safari, Chrome etc. It will save the next person 20+ minutes.

1 Like