I'm trying to fire a click event When web page loaded inside an iframe, but it doesn't seem to be working.
$(function(){
$('#iframe').load(function(){
var iframe = $('#iframe').contents();
iframe.find("#btnSubmit").click(function(){
alert("test");
});
});
});
When i am trying to using this code i am getting the error.
Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "null" from accessing a frame with origin "https://pptform.state.gov". The frame requesting access has a protocol of "file", the frame being accessed has a protocol of "https". Protocols must match.
Please tell me how to resolve this issue. Thanks in advance