This article describes the method of JS to refresh the parent page without popping up a prompt box. Share it for your reference, as follows:
Page A opens the page B. When page B has done a class like saving action, it is necessary to close page B and refresh page A, a prompt box will pop up, requiring you to click to try again. This is an unexpected situation and the user experience is very poor.
There are two solutions:
1. Page A is very simple (no frame/iframe)
In the function in page B:
function close(){ window.opener.location.reload(); window.opener = null; window.open('','_self'); window.close();}That's it.
2. The elements of page A are a bit complicated, with frames, etc.
Requirements: Page B wants to refresh Page A
In the function in page B, directly call the function in page A, take the most common A as the list page and B as the new page:
There is a query button on page A to find all lists. We will trigger this function in page B:
function close(){ window.opener.queryAll(); //queryAll() is the query function window.close();}It should be noted that if frame A on the same page jumps to frameB, it does not use opener, but parent
For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm skills", "Summary of JavaScript animation effects and techniques", "Summary of JavaScript errors and debugging techniques", "Summary of JavaScript data structures and algorithm skills", "Summary of JavaScript traversal algorithms and techniques", and "Summary of JavaScript mathematical operations usage"
I hope this article will be helpful to everyone's JavaScript programming.