Thanks, that worked :)
For anyone reading this who is trying to do the same as I was, here are a few suggestions/tips:
1) Firstly, obviously, make sure you set it up correctly. On the Event Sheet, after adding an event, add the script (the option 'add...' is furthermost right). Ensure 'Use worker' is set to no in the project properties.
2) After exporting the game, to test it, I found using Netflify is a good website to host the game (don't use Itch.io - it blocks the postMessage, though you might figure out how to stop it from doing that).
3) If you want to test that the recipient page is working, you can write a simple code (button with postMessage)then embed the iframe on your page (I used Glitch.com).