重新加载/刷新iframe的最佳方法是什么? [英] What’s the best way to reload / refresh an iframe?

查看:1167
本文介绍了重新加载/刷新iframe的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用JavaScript重新加载< iframe> 。我发现到目前为止最好的方法是将iframe的 src 属性设置为自身,但这不是很干净。有什么想法吗?

I would like to reload an <iframe> using JavaScript. The best way I found until now was set the iframe’s src attribute to itself, but this isn’t very clean. Any ideas?

推荐答案

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

小心,在Firefox中, window.frames [] 不能通过id索引,而是通过名称或索引

be careful, in Firefox, window.frames[] cannot be indexed by id, but by name or index

这篇关于重新加载/刷新iframe的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆