Actually I am offering an iframe
to other users from my website that works perfectly but I want to remove a specific DIV from it if iframe
code is used on some other website, I only allowed my site to show specific Div inside iframe
.
I have already wrote a code that works perfectly on localhost/xampp server but this code won't work on live site I don't know what I am doing wrong in it?
Here is my actual code
<script type="text/javascript">
var frameLocation = window.location.hostname;
var whiteLocation = "<?php echo $ShowMyDomain; // prints mywebsite.com ?>";
if (whiteLocation != frameLocation) {
$('#adprimary').remove();
}
</script>