I have a (parent) page which can open a popup by
popup = window.open("https://localhost:3000/#/new", "popup", "status=1, location=1, width=1000, height=1200");
I have also implemented in the backend (ie, www
):
io.sockets.on('connection', function (socket) {
console.log("LOG: just connected: " + socket.id);
socket.emit('id', socket.id);
socket.on('disconnect', function () {
console.log("LOG: just disconnected: " + socket.id)
})
})
As a result, closing MANUALLY the popup shows LOG: just disconnected: ...
.
From time to time, the parent page wants to change the url of the popup. If I use popup.location.href = newUrl
, the popup does load the new page, but it does NOT disconnect the previous url; there is NO LOG: just disconnected: ...
displayed. And when I close manually the popup, it shows that SEVERAL sockets are disconnected at the same time.
I would prefer the parent page to be able to disconnect the current url of the popup and change to a new url while keep the popup open. Because closing and reopening a popup changes its location/size, this is not what I want.
Does anyone know how to achieve this?