html
<iframe id=h5Content src=></iframe>
js
$(#h5Content).attr(src,${h5.url});h5.url corresponds to a page that is edited and saved to the database.
After modifying the content of this page, the page presented in the iframe has not changed.
reasonThe contents in the iframe will be refreshed only if the src value of the iframe is changed.
So although the page corresponding to the url of my code has changed, the url has remained unchanged, that is, the value of the src of the iframe has not changed. So the content is not refreshed;
SolutionOnce the reason is found, it is very easy to solve. Just think of any way to change the value of the src of the iframe.
My solution at that time is as follows:
$(#h5Content).attr(src,${h5.url}+?time=+new Date().getTime());Pass the value through a question mark to the url and pass the current time, and then it will be solved. This value has no other use, just to change the value of src.
PS: Complete solution to the problem of iframe cache not refreshI encountered a very strange problem these two days. One page has a nested an iframe page. When this page is submitted and jumped to this page again, the original page in the iframe should refresh the data, but it was not refreshed under ie (no problem under FF). You must manually browse F5 or open a new browser tab to refresh. Otherwise, pressing Enter on the browser of this page is useless. I have consulted a lot of information, and finally found that the iframe cache mechanism is messing up. You can solve it with the following methods:
<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 requesting an additional parameter with a value of random number, the browser believes that the page requested is new every time, ensuring that the iframe page is reloaded every time.
This is the article about the solution to not refreshing the content of iframe src pointing. For more related content of iframe src pointing or not refreshing, please search for previous articles of Wulin.com or continue to browse the related articles below. I hope everyone will support Wulin.com in the future!