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

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

问题描述

我有一个加载了一些内容的 iframe.我想在不刷新的情况下将它移动到 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).

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

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

这可能吗?

预先感谢您的帮助.

推荐答案

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

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

但是,如果您尝试将其从 DOM 中实际拉出并插入到其他地方,您将无法避免重新加载.

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天全站免登陆