I have a page hosted on https with iframe content that has http links within it. The framed content is on another domain but is https but I want to be able to make the http links open into a new tab. So far I have not been able to acheive this through jquery.
Example.
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(function() {
$("a[href^='http://']:not([href*='https://'])").each(function() {
$(this).click(function(event) {
event.preventDefault();
event.stopPropagation();
window.open(this.href, '_blank');
}).addClass('externalLink');
});
});
</script>
</head>
<body>
<div class="banner">
<a href="http://example.com">WE ARE STILL HERE</a>
<iframe name="home" scrolling="auto" height="100%" width="100%" noresize="true" src="https://www.example.com">
</iframe>
</div>
</body>
</html>
You can try this with various mixed content pages. You will notice the placeholder link "WE ARE STILL HERE" opens perfectly to a new window while anything in the iframe will not load without choosing to allow insecure content.
Any help will be greatly appreciated.