javascript - Changing src of iframe inside iframe -
i'm getting problem in chrome (running files locally) when try change src of iframe inside iframe, getting error message
error = uncaught securityerror: failed read 'contentdocument' property 'htmliframeelement': blocked frame origin "null" accessing frame origin "null". protocols, domains, , ports must match.
this code i'm using retrieve iframe
iframe = $("iframe").contents().find('iframe'); iframe.attr("src", url);` i don't issue when upload files server. if open them locally error.
it works in firefox , safari.
how can in chrome , in other browser ?
security features built browsers ensure javascript cannot interact objects in other windows and/or frames if windows or frames loaded different site. commonly known "same origin policy". whether loaded different site determined hostname part of url. if example outer frame loaded http://yoursite.com , inner frame loaded http://example.com javascript running in scope of outer frame not able access or modify properties or objects within scope of inner frame.
in case specific error indicating javascript, running in context of outer frame, denied accessing object (contentdocument) scope inner frame. hidden somewhere in jquery trying use implicit access frame's document element (as accessed contentdocument property of iframe).
you may able work around destroying iframe , re-creating new iframe desired src.
Comments
Post a Comment