[Solved] Click a button in two pages at once

Out of Curiosity i just tried MartinWebb’s answer. I hope it might give you a start.

Page # 1:

<button type="button" onclick="hello()">Hello</button>

<script type="text/javascript">
    // window.localStorage.removeItem("text");
    function hello() {
        window.localStorage.setItem("text","Hello there..");

Page # 2:

<p id="show"></p>

<script type="text/javascript">
    window.addEventListener('storage', storage_event_listener, false);

    function storage_event_listener(evt)
        document.getElementById("show").innerText = evt.newValue;
        // console.log(evt);

You can see i have commented a line on my page # 1. It is because “The storage event is fired on the window object whenever setItem(), removeItem(), or clear() is called and actually changes something. For example, if you set an item to its existing value or call clear() when there are no named keys, the storage event will not fire, because nothing actually changed in the storage area.”

So, while experimenting i had to clear my storage item in order to invoke the event.

solved Click a button in two pages at once