Miscellaneous Web Info

"Frameproof" Your Pages | Terms | Horizontal Lines | Keeping Text from Breaking | Printer Controls

"Frameproof" Your Pages

The following code will prevent pirates from opening your page in their frame! <script language=JavaScript> <!-- // This code prevents this page from opening // in someone else's frame // from http://webreview.com/pub/1999/08/13/tag/index.html?wwwrrr_19990813-wt.txt if (self != top) top.location = self.location; // --> </script> This code (with my comments) is from "Frameproof" Your Pages.

Warning: This code breaks the Back button. The actual action is browser dependent.

You can also try adding the following statement to the page's header section. (Same reference as above.) However, it does not work in IE 4.72, IE 5.00, or Netscape Communicator 4.05. (Uh, then what's the point?)

     <! The following line prevents this page from opening 
         in someone else's frame>
     <meta http-equiv="Window-target" content="_top">
It appears that browsers should consider http-equiv settings as just a suggestion, but if you want to ignore them, then that's ok. (I love this kind of standard :(

It is also possible for your web server to scan your pages (now, there's a lame idea) and convert the http-equiv metatags to actual http commands. Like that won't affect server performance.

Let the User Decide

This code let the user decide whether or not to display your page in the pirate's frame. In the dialog box


Terms used to describe those that produce and maintain web content
Webmaster, curator, page keeper

Horizontal Lines

The <hr> code is used to place a visual separation in a web page. Normally, when manually editing a page, this code tends to get lost and is not very noticeable. In order to make the <hr> codes easier to see in your source code, use or In the first case, the asterisks are in a comment and are ignored by the browser; in the second, the asterisks are treated as a unrecognized parameter.

Keeping Text from Breaking

There are many cases where you want to keep text from breaking onto a new line.
Use the non-breakable space to keep to character strings together - J&nbsp;Smith, 12&nbsp;am

<pre> ... </pre> <xmp> ... </xmp>
Preformatted and example blocks are displayed exactly as typed - line breaks are neither added nor removed.
However, the font is changed to courier 
and the block begins and ends with a line break.
Ie, this is not ok for a single phrase within a paragraph.

<nobr> ... </nobr>
While the nobreak tag is implemented in both IE and Netscape, it is not a part of the W3C standard. This has the advantage of working with phrases - <nobr>Dr. John Smith, MD</nobr> and with words which contain hyphens - a <nobr>3-foot</nobr> ruler. Use <wbr> to define optional line breaks within a nobreak block.


Printer Controls

Setting Landscape | Forcing a Page Break

Setting Landscape

Using IE 5+ and Netscape 6+, the following CSS will set the printer default to landscape for the current page The reference also explains how to use CSS to include and/or exclude sections of your page when it is printed.

Forcing a Page Break

Here is a method to force a page break. Then, to force a break, use a <p> tag like this.

Additional References

Author: Robert Clemenzi - clemenzi@cpcug.org
URL: http:// cpcug.org / user / clemenzi / technical / HTML_Examples / Misc.htm