Mobile app version of vmapp.org
Login or Join
Si4351233

: Can hiding site content until JavaScript determines that the site is not framed cause lower Google rankings? This is the javacript code that I use to prevent clickjacking in my current project.

@Si4351233

Posted in: #Javascript #Security #Seo

This is the javacript code that I use to prevent clickjacking in my current project.

<style id="antiClickjack">body{display:none !important;}</style>

<script type="text/javascript">
if (self === top) {
var antiClickjack = document.getElementById("antiClickjack");
antiClickjack.parentNode.removeChild(antiClickjack);
} else {
top.location = self.location;
}
</script>


Does this code affect google ranking? I also implement the X-Frame-Options Header for the site.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Si4351233

1 Comments

Sorted by latest first Latest Oldest Best

 

@Si4351233

In this case you may encounter issues as Google has very strict policies around hiding anything on the page and hiding the whole page would more than likely throw off a very big alarm bell. From what I can see there is strictly no need to hide all the page contents before trying to break the frame, just break it inherently and if it doesn't break out then show an error message in the page at the top of the page above the fold and push everything else below the fold. Shouldn't trigger any Google issues.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme