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

The front end creates and modifies CAD graphics details through JavaScript

Table of contents 1. Current situation 2. Create ...

20 Signposts on the Road to Becoming an Excellent UI (User Interface) Designer

Introduction: Interface designer Joshua Porter pub...

Mysql Sql statement exercises (50 questions)

Table name and fields –1. Student List Student (s...

Problem analysis of using idea to build springboot initializer server

Problem Description Recently, when I was building...

CSS3 clear float method example

1. Purpose Through this article, everyone can und...

Project practice of deploying Docker containers using Portainer

Table of contents 1. Background 2. Operation step...

Pure CSS to achieve input box placeholder animation and input verification

For more exciting content, please visit https://g...

Win7 installation MySQL 5.6 tutorial diagram

Table of contents 1. Download 2. Installation 3. ...

The difference between KEY, PRIMARY KEY, UNIQUE KEY, and INDEX in MySQL

The problem raised in the title can be broken dow...

How to change mysql password under Centos

1. Modify MySQL login settings: # vim /etc/my.cnf...

Distinguishing between Linux hard links and soft links

In Linux, there are two types of file connections...

Use of kubernetes YAML files

Table of contents 01 Introduction to YAML files Y...