Minimal example for the BroadcastChannel API

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<title>Learning the BroadcastChannel API</title>
<script>

$( document ).ready(function() {

// Connect to the channel named "my_bus".
const channel = new BroadcastChannel('my_bus');

// Listen for messages on "my_bus".
channel.onmessage = function(e) {
  console.log('Received', e.data);
};

$( document ).click(function(e) {
	const channel = new BroadcastChannel('my_bus');
	// Send a message on "my_bus".
	channel.postMessage('This is a test message.');
	channel.close();
});

});
</script>
</head>
<body>
</body>
</html>