I am trying to establish communication between two pages in the same domain. I want page B to send a message to everyone that has page A open. Websocket would be the best option, but the webhost does not allow it. I tried broadcast channel and window.postmessage, but none of those options seem to work. Is there a way that this could be done?
This is what I have on page B:
<Button Id=TestButton onClick="swampmap();">Swamp</Button>
<script>
function swampmap() {
top.postMessage('Swamp', location.origin);
}
</script>
This is what I have on page A:
window.addEventListener( "message",
function (e) {
if(e.origin !== location.origin){ return; }
alert(e.data);
},
false);