Search code examples
javascriptwindow

How to reload another tab in javascript?


I work on an admin-side database and we want the admin to open clients' account. Since we use session variables, we want to restrain the admin to one client account at a time.

So here's the plan, when selecting a first client, the client-side page loads in a new tab. If the admin selects a new client, the new tab reloads for this client.

For now, I tried using a global variable named clientWindow and when a client is selected, I do

clientWindow = window.open('site.html?playerid='+playerid, '_blank');
clientWindow.focus();

But it still opens a new tab. Perhaps I'd need a name to put instead of _blank! Thanks for you help.


Solution

  • Give the window an actual name, rather than _blank. Then it becomes part of the DOM, and you can access it directly. Including refreshing it