PDA

View Full Version : what this script does



andrew1234
Dec 3rd, 2002, 02:35 PM
hi can you please tell me what this script does

thanks

andrew



<SCRIPT language=Javascript1.1 type=text/javascript>
<!--
if (window != top)
top.location.href = window.location.href;
// -->
</SCRIPT>

BrainJar
Dec 3rd, 2002, 03:09 PM
top is a reserved name that refers to the topmost browser window (such as when frames are being used). window is also a reserved name that refers to the window or frame that the code is loaded in.

So basically, that code says "if the window I'm in is not the topmost window, reload the top window with my URL."

In other words, it's a frame buster. If you try to load a page with that code into some part of a frameset, it will replace the entire frameset with itself.