Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Do Get Framed

Sometimes a particular web page only makes sense if it appears in a frame, yet users somehow find the page in an unframed state. This particularly tends to happen when users find the page through a search engine. To give the reader a clue that this isn't the page where they should be, paste this Javascript at the top of the page, before any text:

this code produces this
<SCRIPT TYPE="text/javascript">
function checkframed(gourl)
if (top == self)
      '<DIV STYLE="padding:8pt;' + 
      'border-style:solid;border-width:8pt;' + 
      'border-color:66CC33;">' + 
      '<STRONG STYLE="font-size:30pt;' + 
      'font-weight:900;font-family:sans-serif">' + 
      'This page is intended as part of a ' + 
      '<A HREF="' + gourl + '">framed document</A>.' + 


this page

Change the URL in the last line to the URL of the frameset page. For example, if you want people to go to myhomepage.html then set the last line like this:


This script checks to see if the current page is the "top" page (if (top == self)). If it is, it writes out a notice to the user that they would probably rather be at another page, and writes out a link to that page.

You might notice a small disparity between this method and the Don't Get Framed method. In this example the user is presented with a passive link if they are not on the intended web page. In the previous example, however, no permission is asked: the browser is automatically forwarded to the intended page. The reason for this difference lies in the slight difference in intentions between the two pages. The "Don't Frame Me" script is intended to act as a deterrence, to stop somebody else from framing the page. The best deterrence in this case is to unload their page without further ado. The "Do Frame Me" script, however, is not intended to act as a deterrence, only as a gentle reminder, so a gentler method of redirection is used.

  Copyright 1997-2002 Idocs inc. Published under the terms of the Open Content License Design by Interspire