Ideas and codes for implementing iframe in html to control the refresh of parent page

Ideas and codes for implementing iframe in html to control the refresh of parent page
1. Application Scenarios

Parent page a.jsp
Subpage b.jsp, as the page pointed to by the iframe embedded in page a

Copy code
The code is as follows:

<body>
<iframe id="frame" src="b.jsp" .../>
</body>

Now an operation is performed in page b. After the operation is completed, the iframe embedded in page a needs to be refreshed.

2. Ideas

Find page a in page b, then find the iframe in page a, and reassign the src attribute of the iframe.

3. Implementation

In b.jsp

Copy code
The code is as follows:

function refresh(){
var frame = window.parent.document.getElementById("frame");
var path = frame.getAttribute("src");
frame.setAttribute("src", path);
}

This only refreshes the frame, achieving a partial refresh effect.

<<:  How to pass parameters to JS via CSS

>>:  Typical cases of MySQL index failure

Recommend

echars 3D map solution for custom colors of regions

Table of contents question extend Solving the pro...

Example of using Dockerfile to build an nginx image

Introduction to Dockerfile Docker can automatical...

Advantages and disadvantages of Table layout and why it is not recommended

Disadvantages of Tables 1. Table takes up more byt...

Detailed explanation of Linux command file overwrite and file append

1. The difference between the command > and &g...

Docker swarm simple tutorial

swarm three virtual machines 132,133,134 1. Initi...

Use docker to build kong cluster operation

It is very simple to build a kong cluster under t...

Several navigation directions that will be popular in the future

<br />This is not only an era of information...

MySQL 5.7.21 installation and configuration method graphic tutorial (window)

Install mysql5.7.21 in the window environment. Th...

Detailed explanation of MySQL precompilation function

This article shares the MySQL precompilation func...