Uncaught SecurityError: Unable to read property 'contentDocument' from 'HTMLIFrameElement': blocked a frame

advertisements

I want to add JavaScript links to any site urls with iframe. But it returns error like this.

"Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame"

I tried it with javascript.

    $('iframe').contents().find('head').append(created_script);
        created_script=document.createElement('script');
    created_script.src='http://tag-test-super-star.c9users.io/server/js/index.js';
    created_script.type='text/javascript';
    $('.iframe_tag').contents().find('head').append(created_script);

I think there will be solution with php. Is there any?


Please don't use iframe. Please use html dom parser instead iframe.