Run Real JavaScript on a certain webpage

So I'd like to run this JS code in Chrome when I press the '-' key:

(async () => {
stores.toggleAudio()
returnToBTT('foo');
})();

This code works when I run it in Chrome's console, but nothing happens when I press '-' in Chrome. How to debug this?

The real java script action does not have anything to do with Chrome (this runs completely in BTT) :slight_smile:

For running Java Script in Chrome, you need to use Apple Script, have a look here:
google chrome - Can AppleScript access browser tabs and execute javascript in them? - Stack Overflow

Thanks! Was a bit confused.

This is important:

Note: As of August 2018, you may need to navigate to ViewDeveloperAllow JavaScript from Apple Events for execute javascript to work

1 Like