This is an explanation of the video content.
 用技术延续对ACG的热爱
1

 |   | 

使用JS/JQ刷新iframe窗口

1、JavaScript 刷新 iframe 可以使用以下方法:

document.getElementById('some_frame_id').contentWindow.location.reload();

实例:

<iframe id="myframe" width="100%" frameBorder="0" src="https://www.runoob.com scrolling="no"></iframe>
<input type="button" onclick="javascript:refreshFrame();" value="Refresh Frame" />

<script type="text/javascript">
function refreshFrame(){ document.getElementById('myframe').contentWindow.location.reload(true);
}
</script>

2、jQuery 刷新 iframe 可以使用以下方法:

$('#iframe').attr('src', $('#iframe').attr('src'));

1 🖺前端 ↦ JavaScript开发技巧 __ 37 字
 JavaScript开发技巧 #23