jeudi 8 mars 2018

I am trying to show a div conditionally, only if the page is framed on a domain besides my own

example domain : mydomain.com

if(location.hostname.indexOf("mydomain") >= 0){ $("#load").css({display: "none"}); }

this is currently working to hide the div, but even on a different domain it is hiding the div, which i think may be because the iframe is still mydomain? I asked this before and it got deleted, but i got a response which was sort of like the above code. i changed it to get the hostname, since window.parent.location would show the div still for some people on my website. i also tried with an else statement to display block, which didn't render any different result. thanks for your time.

Aucun commentaire:

Enregistrer un commentaire