3
There is the possibility when the person clicks on a link in a iframe
, this link opens in another tab?
I don’t have control of the HTML of the other page, so I can’t put the _blank
at the link by HTML.
3
There is the possibility when the person clicks on a link in a iframe
, this link opens in another tab?
I don’t have control of the HTML of the other page, so I can’t put the _blank
at the link by HTML.
0
Yes, it is possible. Just add the target="_blank"
all links. Example with jQuery:
$(document).ready(function () {
$("iframe").load(function () {
var iframe = document.getElementById("iframe")
var anchors = iframe.contentDocument.getElementsByTagName("a");
for (var i in anchors) {
anchors[i].setAttribute("target", "_blank");
}
});
});
Unable to manipulate page due to security policy of the same origin.
However, you can do a trick, creating a proxy that provides a mirror of the original page in your domain. This can only be done with server-side languages.
Browser other questions tagged javascript html jquery
You are not signed in. Login or sign up in order to post.
Hello @rodorgas, just to add content to your answer, this case of policy of the same origin not only refers to situations of equal domains, there are other criteria that are analyzed, worth taking a look at this contents.
– RXSD