Problem Description html <iframe id="h5Content" src=""></iframe> js $("#h5Content").attr("src","${h5.url}"); h5.url corresponds to a page edited by ueditor and saved in the database. After modifying the content of this page and submitting it, the page presented in the iframe does not change. reason The content in the iframe will be refreshed only when the value of the iframe's src changes. So although the page corresponding to the URL of my code has changed, the URL has not changed, that is, the value of the src of the iframe has not changed. Therefore, the content is not refreshed; Solution Now that the cause is found, the solution is very easy. Just think of any way to change the value of the iframe's src. $("#h5Content").attr("src","${h5.url}"+"?time="+new Date().getTime()); Pass the current time after the question mark to the URL and the problem is solved. This value has no other use except to change the value of src. PS: Complete solution to the problem of iframe cache not refreshing I encountered a very strange problem these two days. A page nested an iframe page. When this page was submitted and jumped to this page again, the page in the iframe should have refreshed the data, but it did not refresh under IE (no problem under FF). It must be refreshed manually by pressing F5 or opening a new browser tab. Otherwise, pressing Enter on the browser of this page is useless. After consulting a lot of information, I finally found that it was the iframe cache mechanism that was causing trouble. The following method can solve it: <script type="text/javascript"> var randomnumber = Math.floor(Math.random()*100000) document.write(' <iframe src="http://www.freedonation.com/hunger/hunger_thankyou.php3?random='+randomnumber+'" name="aframe" width="100%" height="400"></iframe>') </script> By adding a parameter with a random number as the request value, the browser considers that each requested page is new and ensures that the iframe page is reloaded each time. This concludes this article on how to solve the problem when the content pointed to by the iframe's src does not refresh. For more information about the problem when the content pointed to by the iframe's src does not refresh, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: This article will help you understand JavaScript variables and data types
>>: Ubuntu boot auto-start service settings
I just learned some html yesterday, and I couldn...
The vue project implements an upgraded version of...
Table of contents 1. Location / Matching 2. Locat...
To beautify the table, you can set different bord...
500 (Internal Server Error) The server encountere...
Table of contents Business requirements: Solution...
The effect to be achieved is: fixed zoom in twice...
Slow query log related parameters MySQL slow quer...
The installation of MySQL 5.7 on Ubuntu 1804 is i...
Recently I changed Apache to nginx. When I moved ...
1. Introduction I won’t go into details about apo...
Preface NAT forwarding: Simply put, NAT is the us...
This article shares the specific code of js to ac...
The meaning of key_len In MySQL, you can use expl...
Table of contents 1. Test experiment 2. Performan...