links within an iframe window to open in new tab

admin

Administrator
Staff member
I have seen this question many times, and a lot of the answers seem to suggest the base
Code:
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
Code:
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.

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

JS

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

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.