April 4, 2000 - Escaping Frames
April 4, 2000|
Tips: April 2000
Yehuda Shiran, Ph.D.
HEADportion of your document, you can ensure that the page loads in the entire window. Here's the script:
The condition evaluates to
true only if
window is not equal to
top. In other words, if the page's direct window isn't the topmost window in the browser, the condition evaluates to
top is the highest window object in the hierarchy. If the topmost page doesn't feature any frames, the object model has only one level of window objects, so
top is equal to
window. However, if the browser is currently displaying a frame-based document, each child frame has a corresponding window object.
Note that the following expressions would also function properly:
window != parent self != top
Back to the script. If the page's window isn't the topmost window in the object model, your page is being displayed as a frame in a frame-setting document. In order to escape the frames, you need to set the URL of the upper window to the URL of the current page:
if (window != top) top.location.href = location.href;