0

For example: tried to hide the wiki-logo by hiding the class ("#central-featured-logo" which is associated with the wiki logo) but didn't work

<script>
    $(document).ready(function () {
 try {
       if(window.name != "") 
       {
         document.getElementById("#central-featured-logo").style.display ='none';
       }   
     }  
    catch (e) { alert("Error:  " + e); }
});
</script>
<iframe  width="100%" height="400" src="https://www.wikipedia.org/"></iframe>

1 Answers1

0

You should not pass along the hashtag to document.getElementById. It also appears that central-featured-logo is a class, not an ID, so you would want to use document.getElementsByClassName instead:

$(document).ready(function () {
 try {
       if(window.name != "") 
       {
         document.getElementsByClassName("central-featured-logo")[0].style.display ='none';
       }   
     }  
    catch (e) { alert("Error:  " + e); }
});
Blue
  • 22,608
  • 7
  • 62
  • 92
  • Thanks for your input.The main objective is to stop the logo from loading/showing up & it's still not serving the purpose. – user3225266 Jul 06 '15 at 10:07
  • I think the issue you are running into is probably the [same origin](http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy) policy. – Blue Jul 06 '15 at 10:08
  • .yes you are right.. what if i load the page using ajax,jscript etc instead of iframe? i mean how to avoid "same origin policy" ? – user3225266 Jul 06 '15 at 10:41
  • Have a look [here](http://security.stackexchange.com/questions/8264/why-is-the-same-origin-policy-so-important) on why the same origin policy is important, and why it's in place. Have a look [here](http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy) on ways to circumvent this restriction. – Blue Jul 06 '15 at 15:15
  • ........tried to load the page without iframe & applied your corrections. Can you please see what's wrong over here: [link]http://codepad.viper-7.com/zlAplp – user3225266 Jul 12 '15 at 06:03