【问题标题】:How to force a hyperlink inside IFrame to open into a new window?如何强制 IFrame 中的超链接在新窗口中打开?
【发布时间】:2020-02-27 05:50:18
【问题描述】:

我的代码贴在下面:-

<!DOCTYPE html> 
<html> 
 <head>
<base target="_blank">
</head>
<body> 

<div style="border: 2px solid #D5CC5A; overflow: hidden; margin: 15px auto; max-width: 800px; max-height: 1750px;">
<base target="_blank" />
<iframe name="myIframe" scrolling="auto" src="http://example.com" style="border: 0px none; margin-left: -30px; height: 4000px; margin-top: -900px; width: 850px;">
</iframe>
</div>
</body> 
</html> 

我尝试过使用 target 属性,但没有成功。请帮忙。

【问题讨论】:

  • 能否请您展示您尝试过的内容,提供的示例中没有链接。还要详细解释问题,“not working”不是正确的问题描述。
  • "如何强制超链接inside IFrame在新窗口中打开?" -- 首先,如果您无权访问原始资源,则无法将任何内容更改为 iFrame。第二件事,这个问题很不明白,请详细说明。

标签: javascript jquery html css iframe


【解决方案1】:

我希望这对你有用:

<!DOCTYPE html> 
<html> 
 <head>
<base target="_blank">
</head>
<body> 

<div style="border: 2px solid #D5CC5A; overflow: hidden; margin: 15px auto; max-width: 800px; max-height: 1750px;">
<base target="_blank" />
<iframe name="myIframe" scrolling="auto" src="http://example.com" style="border: 0px none; margin-left: -30px; height: 1000px; width: 850px;">
</iframe>
</div>
</body> 
</html> 

我取出margin-top的值:-900px;在查看区域中获取所需的文档。

【讨论】:

  • 我很确定页边距对超链接的目标没有影响。
猜你喜欢
  • 2010-11-05
  • 2011-07-07
  • 1970-01-01
  • 2013-10-09
  • 2011-02-24
  • 1970-01-01
相关资源
最近更新 更多