我问这个是因为我想在iframe中显示一个页面,在点击iframe内容中的任何链接时,它应该在同一个iframe中显示。
检查site。看看iframe如何让我去浏览其他网站。
答案 0 :(得分:1)
这不是什么特别的,这就是iframe的运作方式。
但是,如果这些网站中有任何一个
<a href="LINK" target="_top">text</a>
它会突破iframe并加载主页面。
我无法通过target = _top链接阻止iframe接管您的窗口。您无法在父窗口中修改iframe中的其他人的内容,因此在交叉框架中存在安全问题,导致您无法执行此操作。
使用Thickbox只需加载你的html文件,并确保你不想在任何想要留在iframe中的页面中定位= _top。
所以复制&amp;从ThickBox的例子中粘贴一些jQuery:
<script>
var height = 300;
var width = 300;
$(function(){
$("#execute").click(function(){
$("#link1").attr('href',$('#go').val() + "?height=" + height *"&width=" + width).trigger('click');
});
});
</script>
<input type="text" name="go" id="go" />
<button id="execute">Go >></button>
<a id="link1" href="ajaxOverFlow.html?height=300&width=300" title="add a caption to title attribute / or leave blank" class="thickbox">Scrolling content</a>
答案 1 :(得分:0)
Facebox插件将以厚箱方式拉入远程页面。