链接在iframe窗口中打开新选项卡 [英] links within an iframe window to open in new tab

查看:373
本文介绍了链接在iframe窗口中打开新选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我多次看过这个问题,很多答案似乎都提示基础 target =_ blank技巧。不过,我以前曾经用过这个;但我目前的页面不起作用。即使它有效,我也不认为这是最好的选择;因为我只希望 iframe src =中的链接在新窗口中打开。我跳了一个简单的解决方案,我可以在页面上添加内联。

I have seen this question many times, and a lot of the answers seem to suggest the base target="_blank" technique. However, I have used this before in the past; but my current page it does not work. I also don't think it could be best option even if it did work; as I ONLY want the links within the iframe src="" to open in a new window. I am hopping there's a simple solution I can add inline to the page. I have also tried adding an id as below, and using JavaScript, still nada.

<iframe src="mywordpressfeed.html" id="frame1" width="310" height="380"></iframe> 

JS

$(document).ready(function(){
    $("#frame1").attr("target","_blank");
});

基本上,我们的目标是当用户在iframe中看到我的WordPress feed时, ;一旦单击帖子标题,它将加载到一个新窗口中 - 就像现在它加载在同一个iframe中一样,所以没有增加可读性级别。

Basically the goal is to when a user sees my wordpress feed within the iframe I have on a static page; once the post title is clicked it loads in a new window - as now it loads within the same iframe so there isn't an increased level of readability.

推荐答案

这篇关于链接在iframe窗口中打开新选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆