Get HTML Title & URL of Front Browser Page (Safari & Google Chrome)

This macro works fine with Safari, but does not deliver the Google Chrome TITLE, only:


get-html TTL & URL of Front Browser (Safari & Chrome).kmmacros (2.1 KB)

What am I missing here?

with best regards,
Omar KN, Stockholm, Sweden

Hi Omar,

When I tested this, it worked immediately in Chrome but failed in Safari (URL but no title).
The error I got was:
DoJavaScript failed Safari got an error: You must enable the 'Allow JavaScript from Apple Events' option in Safari's Develop menu to use 'do JavaScript'.

I would check ~/Library/Logs/Keyboard Maestro/Engine.log to see if you're getting any similar errors.

1 Like

What I did is I had a look in Google Chrome Settings > Sec & Privacy > Site Settings > JavaScript > Sites can use Javascript, and it was checked already.

Then I tested the macro, and there - it worked, but I had not toggled even any specific setting.

So far, so good, but strange.

Thank you for your help, I'm using these URL / Title macros all the time here.

with best regards,
Omar KN, Stockholm, Sweden

That's meaningless in this context...


The fact that you're getting a URL means its working properly.

Make sure you're testing with a web page that has a title.

The URL you cite above can't be reached from my end.

Your macro works find on my Mojave system with Google Chrome 112.0.5615.49 using this page to test with.

It must have been a temporary 'hick-up' of some kind, it worked before and again today, after going into the settings, that's all I did.

View > Developer > Allow JavaScript … was checked from the start.

Next time it happens I'll go into Engine.log as @avtraino Vito suggested…

with best regards,
Omar KN, Stockholm, Sweden