Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript line of code in plain english

Tags:

javascript

There is this line of code that is on most of our pages that I'm trying to figure out what it's for 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 it's probably a silly question, but what is this line of script trying to say. Could this be related to the sign in functionality?

Thanks in advance

like image 312
Kevin Avatar asked Dec 26 '22 10:12

Kevin


1 Answers

if (top != self) { // if the top frame isn't this window
    top.location.replace( // set the top frame's location
        self.location.href // to this window's location
    );
}
like image 185
Paul S. Avatar answered Dec 28 '22 06:12

Paul S.