【问题标题】:Chrome ignores target attribute inside Angular2 appChrome 忽略 Angular2 应用程序中的目标属性
【发布时间】:2016-07-21 10:05:43
【问题描述】:

我想在 iframe 中打开一个链接,就像 W3Schools 中描述的那样:

<iframe height="300px" width="100%" src="demo_iframe.htm" name="iframe_a"> </iframe>

<p><a href="http://www.w3schools.com" target="iframe_a">W3Schools.com</a></p>

当我把它放在像这样的 Angular2 应用程序中时:

<my-app>  
  <iframe height="300px" width="100%" src="demo_iframe.htm" name="iframe_a"></iframe>
  <p><a href="http://www.w3schools.com" target="iframe_a">W3Schools.com</a></p>    
</my-app>

然后它在 IE 11 中可以正常工作,但在 Chrome 中,链接会在新标签页中打开。

如果它在 Angular2 应用程序之外,它在 Chrome 中可以正常工作。

查看 Plunker 中的示例:http://plnkr.co/edit/TNfGuCFZ3cl5IwFHUhIw?p=preview

在这个问题上有什么经验吗?

【问题讨论】:

    标签: google-chrome iframe angular


    【解决方案1】:

    如果您使用 javascript 动态创建 iframe,Chrome 将遵循目标。

    this answer

    【讨论】:

      猜你喜欢
      • 2016-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-11
      • 2019-08-06
      • 1970-01-01
      • 2021-12-23
      相关资源
      最近更新 更多