I am trying to get the code below working on a cross domain iframe however it catches the click and doesn't pass it through. Can someone tell me what is wrong with it.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div class="iframeholder">
<iframe src="https://somesite.com"></iframe>
</div>
</body>
</html>
<style>
iframe{pointer-events:none;}
</style>
<script>
$(document).ready(function () {
$('.iframeholder').on('click', function(e) {
e.preventDefault();
alert('test');
});
});
</script>
Also, if I want to bind another click with it to trigger a click on another link automatically is this possible (ie there will be two links within the iframe) using the below code and replace the part it with of alert('test'); from the above code or would i hit a xss error:
$( "iframeholder" )
.mousedown(function() {
$( this ).trigger('click');
})
All help would be appreciated, I am a newbie :)