How to refresh tab from another using Javascript

I am looking to achieve something like Wordpress when you create a new message. This allows you to view your post by opening a new tab. If after that you edit the message and view it again, instead of opening another tab, it will update the previously opened tab (provided that it is still open).

From some studies, it seems that I can open a new window and give it a name to identify it, for example:

window.open(url,"foobar");

But how can I update this tab later? location.reload() does not seem to accept the name as an argument.

+6
source share
3 answers

If I remember correctly, this is the way to do this:

 var win = window.open(url, "foobar"); win.location.reload(); 
+11
source

I think you are looking for the window.opener property. See http://www.w3schools.com/jsref/prop_win_opener.asp

+1
source

You can do this with the "storage" event. for more details follow

Link between tabs or windows

https://developer.mozilla.org/en-US/docs/Web/Events/storage

0
source

Source: https://habr.com/ru/post/916143/


All Articles