Forcing a Page into a Frame

When a search engine catalogs one of your pages, it doesn’t know that the page is part of a frame. When a user finds your page via the search engine, clicking the link shows just the single page, not the full frameset as you designed it. Script 5.3 shows the frameset. The page the user landed on (not shown) contains a call (just like the one in Script 5.1) to the JavaScript. Script 5.4 shows you how to force the full frameset to display even though Google or another search engine doesn’t know about the frameset. Figure 5.4 shows the page looking out-of-place, and Figure 5.5 shows it at home, snug in its frame.

Figure 5.4. A lonely page, stranded by itself.

Figure 5.5. Our page, happily reunited with its parent ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.