Is my page framed?Question: Is my page framed (loaded in a frameset) or is it in the browser's top-level window? Answer: To test whether your page is in a frameset, you can use this conditional operator: if (self != top) // if yes, you're framed if (self == top) // here you aren't framedExample. Let's assume that your site uses frames to provide some navigation functionality if (self==top) { // The page is not in the frameset index.htm !!! document.write('<p><a href="/index.htm">Home page</a>') }A similar code is used on this page. If you open this page in the top-level window of your browser, you'll see a hyperlink Contents (at the top of the page, right under the page title). This hyperlink will bring you back to the framed view. See also: IFRAME s
|
Copyright © 1999-2011, JavaScripter.net.