创建一个带有空src的iframe,这是符合标准的“#”替代方案。 [英] Create an iframe with an empty src that's a standards compliant alternative to "#"

查看:83
本文介绍了创建一个带有空src的iframe,这是符合标准的“#”替代方案。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面上有一个iframe,我最初需要一个空白src,因为我最终使用javascript设置了src。



我一直在使用然而,在Safari和Chrome浏览器中遇到了一个问题,它会在iframe中加载我的页面的副本。



我在另一个问题中阅读了关于about:blank的内容我读过IE9发送一个空请求到服务器,当你使用这个作为src。我还没有找到任何列出此src作为标准兼容的任何东西。



任何人都可以选择使用about:blank来创建一个空的iframe吗? src-valid> about:blank 是做到这一点的方法。或者,您可以后面插入整个< iframe> 元素,不要担心有效的空 src


I have an iframe on a page that I need to initially have a blank src for, as I eventually set the src with javascript.

I had been using a however have encountered an issue in Safari and Chrome where this loads a duplicate copy of my page within the iframe.

I read about "about:blank" in another question, however I've read that IE9 sends a null request to the server when you use this as the src. I've also yet to find anything listing this src as standards compliant.

Does anyone have an alternative to "about:blank" that they use to create an empty iframe?

解决方案

about:blank is the way to do it. Alternately, you could just insert the whole <iframe> element with JavaScript later, and don't worry about a valid "empty" src.

这篇关于创建一个带有空src的iframe,这是符合标准的“#”替代方案。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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