Frames Handling Demonstration
Click here to see the Frameset page as defined
Click on the following links to see the frame enforcement code in action>
- Frame 1 is in the same directory as the frameset page
- Frame 2 is in the same directory as the frameset page
- Frame 3 is in a subordinate directory to the frameset page
The frameset.js script file provides the following frameset utility functions. Feel free to copy the code, but please retain the source information.
- setwindowtitle("optional supplied title")
- Sets the window title to either the specified title , or the title of the frame page. Typically used without parameters for the onload event in the body tag of a child frame page
- checkchildframe("frameset-page", "frame-name")
- Checks that a page has been loaded within a frameset defined in the same, or a parent directory. If not, the required frameset page is loaded with the current page in its current frame. frameset-page is the (relative) url of the required frameset page (do not use an absolute url), frame-name is the name of the frame the page should be loaded in. This function should be called within the head of a framed page and the frameset page should use populateframes for the onload event in its frameset tag. A cookie with the same name as the target frame is normally used to pass the required page information. Where cookies are not supported, or have been disabled search parameters are used to pass this information.
- populateframes()
- Completes the actions initiated by checkchildframe. This funcion should be used for the onload event of a frameset page. It is included in the script file here for convenience, but you would probably embed it within your frameset page as that is the only page where it is required. It checks for the existence of cookies with the same name as the frames in the page, any cookie found to exist is read, the corresponding frame loaded with the identified page, and the cookie is deleted. Where cookies are not enabled, search parameters are used. If any named frame is not populated from the above actions or by the frameset definition, it will be populated from the file <framename>.html in the same directory as the frameset.
- framebreakout()
- Break out of a third party frame. Should be called within the head of a frameset page. Not strictly necessary if you use populateframes, but saves having to load your frameset before you break out.
The following functions are also provided
- SetCookie("name", "value", opt "expires", opt "path", opt "domain", opt "secure")
- The usual cookie storage routine.
- GetCookieValue("name")
- The usual function returning a cookie value
- DeleteCookie("name")
- The usual cookie deletion function (with the addition that the cookie content is deleted as well as it's expiry caused).
- GetSearchValue("name")
- Retrieve a search parameter from the top window.