I am trying to solve this problem since morning now. I want the an image file (logo) with an iframe to change depending on certain URLs. That is when the iframe is embedded inside a specific domain there is an internal logo and when it is embedded outside of the domain there is logo external. But I keep on getting this error SecurityError: Blocked a frame with origin from accessing a frame with origin Protocols, domains, and ports must match. I dont know how can I work around this? Is there an alternative way to do this?
here is my code
jQuery(document).ready(function($){
var currentUrl = window.parent.location.hostname;
if (currentUrl == 'www.mysite.com' || currentUrl == 'www.specific.com') {
$(function() {
$('img').remove('.logo-external');
});
} else {
$(function() {
$('img').remove('.logo-internal');
});
}
});
<div class="footer-right">
<a class="logo" href="" target="_blank">
<img class='logo-external' src="{{ ASSET_PATH }}logo-external.jpg" height="18" />
<img class='logo-internal' src="{{ ASSET_PATH }}logo.png" height="18" />
</a>
</div>