When I open a child window from a parent window, I want it to reload after saving but sometimes the child window returns a blank page.
I want to reload the child window independent of the parent window action.
My code that reloads the window:
setTimeout(() => location.reload(true), 2000);
2
Answers
This code will open a child window when the document is ready. The child window will have an onbeforeunload event listener that reloads the parent window when the child window is closed. This ensures that the parent window is always refreshed when the child window is closed.
Do not use Firefox’s
forceGet
parameter as it is experimental and not widely supported.Avoid using it if it’s unnecessary.