如何防止iframe在DOM中移动时重新加载 [英] How to prevent an iframe from reloading when moving it in the DOM

查看:688
本文介绍了如何防止iframe在DOM中移动时重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iframe加载了一些内容。我想把它移动到DOM里面,而不会引起刷新(我喜欢它里面的内容,我想保留它)。



我正在做一些基本的 node.appendChild(iframe)来做这项工作。



可以吗?



提前感谢您的帮助。

解决方案

如果您想在视觉上移动,可以尝试修改CSS以使用绝对定位或其他一些调整。



但是,如果您尝试将其从DOM中拉出并将其插入其他位置,您将无法避免重新加载。


I have an iframe loaded with some content. I would like to move it inside the DOM without causing a refresh (I like the content inside it, I want to keep it).

I'm doing some basic node.appendChild(iframe) to do the job.

Is that possible?

Thanks in advance for your help.

解决方案

If you're trying to move it visually, you can try modifying the CSS to use absolute positioning or some other adjustments.

However, if you're trying to actually pull it out of the DOM and insert it somewhere else, you won't be able to avoid a reload.

这篇关于如何防止iframe在DOM中移动时重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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