What does javascript snippet mean?

if(self!=top){ window.open(self.location,'_top'); }

Can someone explain this?

EDIT

What do they mean self!=topand window.open(self.location,'_top')accordingly?

+3
source share
3 answers

This will exit the HTML frame and replace the top level with the current page.

This is like clicking on the link with target="_top", which will throw out the full set of frames and replace it with a link to the page that the link points to. This is exactly what this code does by simply “opening a link” (in user terms, in JavaScript, it takes the form window.open) to the very page that we see, but at the top level.

self , . top - , . , self == top. , , , .

, self != top , , window.open, , , target, "_top" ( .

+5

-. .

+4

, " , , , "

0

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


All Articles