Safari Javascript works in Safari console, doesn't work when run from KM?

For anyone else struggling with this, checking the log, showed:

execution error: Safari got an error: You must enable the 'Allow JavaScript from Apple Events' option in Safari's Develop menu to use 'do JavaScript'

Of course, doing this, and it worked fine.