如何强制iFrame打开iFrame中的所有链接?
我正在托管一个iFrame,当链接指向外部域时,它似乎会将其加载到主窗口中,而不是iFrame中。 有没有办法强制在同一iFrame中打开链接 注意:我可以向iFrame中加载的页面添加任何我想要的内容(使用Chrome扩展) 我试着加上:如何强制iFrame打开iFrame中的所有链接?,iframe,google-chrome-extension,Iframe,Google Chrome Extension,我正在托管一个iFrame,当链接指向外部域时,它似乎会将其加载到主窗口中,而不是iFrame中。 有没有办法强制在同一iFrame中打开链接 注意:我可以向iFrame中加载的页面添加任何我想要的内容(使用Chrome扩展) 我试着加上: <base target="_parent" /> 但它没有任何好处…检查外部域页面的标题。如果X-Frame-Options标题设置为DENY,浏览器将忽略将内容加载到iframe或框架集,并加载到浏览器的主框架中 Regardless
<base target="_parent" />
但它没有任何好处…检查外部域页面的标题。如果
X-Frame-Options
标题设置为DENY
,浏览器将忽略将内容加载到iframe或框架集,并加载到浏览器的主框架中
Regardless of the site attempts the page cannot be displayed in a frame.
你的代码
用于将结果加载到当前结果的父浏览上下文中。如果没有父项,此选项的行为方式与\u self
相同,因此无法解决您的问题
使用
相反,其中myframe
是iframe的名称
<iframe width="200" height="200" name="myframe"></iframe>
示范
查找用于加载页面的服务器头
<html>
<head>
<base target="myframe">
</head>
<body>
<a href="hi.html">Base</a>
<a href="bye.html">A Tag</a>
<iframe width="200" height="200" name="myframe"></iframe>
</body>
</html>
工具书类