Business web hosting - 363Chapter 16Window and Frame ObjectsListing 16-1: Prevention from

363Chapter 16Window and Frame ObjectsListing 16-1: Prevention from Getting Framed Your document may appear momentarily inside the other site s frameset, but then the slate iswiped clean, and your top-level document rules the browser window. Ensuring framingWhen you design a Web application around a frameset, you may want to make sure that apage always loads the complete frameset. Consider the possibility that a visitor adds onlyone of your frames to a bookmarks list. On the next visit, only the bookmarked page appearsin the browser, without your frameset, which may contain valuable navigation aids to the site. A script can make sure that a page always loads into its frameset by comparing the URLs ofthe topand selfwindows. If the URLs are the same, it means that the page needs to load theframeset. Listing 16-2 shows the simplest version of this technique, which loads a fixed frame- set. The listing includes a workaround for an NN4-specific behavior that prevents printing aframe. (NN4 for Windows and UNIX reloads a page into a separate hidden window for printingand runs any immediate scripts in the process.) For a more complete implementation thatpasses a parameter to the frameset so that it opens a specific page in one of the frames, seethe location.searchproperty in Chapter 17. Listing 16-2: Forcing a Frameset to Load

Leave a Reply