gpt4 book ai didi

javascript - 刷新 iframe

转载 作者:数据小太阳 更新时间:2023-10-29 04:59:36 25 4
gpt4 key购买 nike

如何刷新 iframe?例如:

<iframe src="http://google.com"></iframe>

我点击这个 iframe 中的“视频”,然后点击一个按钮来刷新 iframe,我希望当 iframe 刷新时,出现在那个“视频”页面上。

最佳答案

由于单源策略,您无法刷新其中的内部文档。

您是否尝试过更改 iframe 的 src 属性并添加随机 GET 字符串以强制重新加载?

这应该有效:

<iframe id="myiframe" src="http://google.com"></iframe>

document.getElementById("myiframe").src = "http://www.google.com?"+(+new Date());

关于javascript - 刷新 iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3244877/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com