Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

Building an Automatic Frame

Frame External Pages So You Don't Lose Your Readers

By Jennifer Kyrnin, About.com

When you spend a lot of time building up a Web site, sometimes it can be frustrating to link to an external page and know that your readers will leave and possibly forget about your site altogether. But if you put a small frame on all your outbound links, you can be sure that they will remember your site.

Building the Templates

First you have to think about what your frame will be like. It's good form to keep it small and unobtrusive. And you should include both a link back to your site, and a link to turn off the frame if your readers find it annoying.

Then build the basic format for the top frame. I decided to make a small frame with just a link back to my site and another link to turn off the frame:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Navigation Frame</title>
</head>
<body bgcolor="#cc99ff" link="#ffffff" vlink="#ffffff">
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
<td><a href="">Return to the HTML Site</a></td>
<td align="right"><a href="" target="_top">Remove this frame</a></td>
</tr></table></body>
</html>

Note that the two links are blank because they will be built with the CGI using variables.

The frameset code I'll use for these pages will look like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>HTML Site Framed Link</title>
</head>
<frameset rows="30,*">
<frame name="top_nav" src="frame.cgi?top=y&url=$url&refer=$refer" marginwidth="10" marginheight="10" scrolling="no" frameborder="no" noresize>
<frame name="" src="" marginwidth="10" marginheight="10" scrolling="auto" frameborder="no">
<noframes>
This link is framed, <a href="">click here</a> to see the page without a frame.
</noframes>
</frameset>

The source of the top frame is built by the same CGI that builds the frameset.

Explore Web Design / HTML

About.com Special Features

Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. HTML and XHTML
  5. XHTML
  6. Frames
  7. Scripting Frames
  8. How to Build an Automatic Frame - Frame Your External Links with an Automatic Frame

©2009 About.com, a part of The New York Times Company.

All rights reserved.