Javascript English line of code

Most of our pages have this line of code in which I'm trying to figure out why this is done, and if I can remove it.

It looks like this:

<script type="text/javascript">
  /*<![CDATA[*/
  if(top!=self){top.location.replace(self.location.href);}
  /*]]>*/
</script>

I know this is probably a stupid question, but what does this line of script say. Could this be due to the functionality of the sign?

Thanks in advance

+4
source share
1 answer
if (top != self) { // if the top frame isn't this window
    top.location.replace( // set the top frame location
        self.location.href // to this window location
    );
}
+10
source

Source: https://habr.com/ru/post/1538488/


All Articles