【问题标题】:Iframe HTML without src没有 src 的 iframe HTML
【发布时间】:2013-06-04 11:36:30
【问题描述】:

我在网站中有这段代码

<iframe src="" name="" width="" height="">

        <html>
        <head>
            <meta property="og:title" content="Title" />
            <meta property="og:type" content="website" />
            <meta property="og:description" content="This Is The Description Section" />
        </head>
        <body>
            <div id="fb-root"></div>
            <script>    (function (d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id)) return;
                js = d.createElement(s); js.id = id;
                js.src = "";
                fjs.parentNode.insertBefore(js, fjs);
            } (document, 'script', 'facebook-jssdk'));</script>

<div class="fb-comments" data-href="@Request.Url" data-width="300" data-num-posts="3"></div>

        </body>
        </html>
        </iframe>

这段代码不起作用,但我不知道为什么?谁能帮帮我?

【问题讨论】:

  • 你的意图是什么?那不是应该如何使用 iframe
  • 定义“不工作”?你期望会发生什么? iframe 不能直接包含内容,请将 src 属性设置为您提供内容的 URL。
  • 我想在这个 iframe 中使用 facebook cmets
  • 我想在 iframe 中编写 html,因为我想更改它的内容
  • 你为什么不把你的src指向一个你想做的asp页面?!

标签: asp.net asp.net-mvc iframe


【解决方案1】:

关于您的代码为什么不起作用的问题:iframe 允许您嵌入另一个文档;你必须指定它的位置。您不能在 iframe 标记内输入 HTML 代码。

W3schools 表示您可以在不支持iframes 的浏览器的文本之间插入文本,就像noscript 标签一样。

查看W3 specification 并使用src 属性和另一个文档。

【讨论】:

猜你喜欢
  • 2018-04-15
  • 2013-02-11
  • 2013-08-05
  • 2012-04-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-11-13
相关资源
最近更新 更多