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

Vue routing lazy loading details

Table of contents 1. What is lazy loading of rout...

In-depth analysis of the Linux kernel macro container_of

1. As mentioned above I saw this macro when I was...

MySQL optimization query_cache_limit parameter description

query_cache_limit query_cache_limit specifies the...

Detailed tutorial on installing and using Kong API Gateway with Docker

1 Introduction Kong is not a simple product. The ...

Solution to the problem that Centos8 cannot install docker

Problem [root@zh ~]# [root@zh ~]# [root@zh ~]# yu...

Docker container monitoring and log management implementation process analysis

When the scale of Docker deployment becomes large...

WeChat applet implements countdown for sending SMS verification code

This article shares the specific code for the WeC...

Sample code for batch deployment of Nginx with Ansible

1.1 Copy the nginx installation package and insta...

Detailed explanation of MySQL combined query

Using UNION Most SQL queries consist of a single ...

Vue development tree structure components (component recursion)

This article example shares the specific code of ...

js object to achieve data paging effect

This article example shares the specific code of ...

Goodbye Docker: How to Transform to Containerd in 5 Minutes

Docker is a very popular container technology. Th...

Design and implementation of Vue cascading drop-down box

Table of contents 1. Database design 2. Front-end...

Tutorial on upgrading from Centos7 to Centos8 (with pictures and text)

If you upgrade in a formal environment, please ba...

MySQL data backup and restore sample code

1. Data backup 1. Use mysqldump command to back u...