Updating after modifying CSS or JS loaded by a page displayed in an iframe
I have page INNER loading in an iframe in page OUTER. I'm noticing that when I've updated some of the CSS and JS files that INNER loads, when refreshing OUTER, the updates don't show. Is there a way to force INNER to check for changes in CSS and JS upon开发者_运维知识库 every load?
Add the following code to the Inner Web Page (loaded within the iframes)
<head>
<meta http-Equiv="Cache-Control" Content="no-cache">
<meta http-Equiv="Pragma" Content="no-cache">
<meta http-Equiv="Expires" Content="0">
</head>
You can also do it from the parent page:
document.getElementById(FrameID).contentDocument.location.reload(true);
or perhaps
parent.frames[FrameID].window.location.reload();
Furthermore, a workaround sometimes used is to re-assigned the src attribute's value. However, this is not guaranteed to provide a full refresh. This is sometimes coupled with adding a querystring value when resetting the src. Example: domain.com/page?id=123
精彩评论