Useful HTML Code Snippets

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

Eliminate margins on web page

MSIE has one method, and Netscape has another. This will cover both standards.

<BODY topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 ...

 

A working NoCache hack

Tell browser not to cache web page you are visiting. Simply placing the line:

 <META HTTP-EQUIV="Pragma" CONTENT="no-cache">

in the HTML page HEAD is unreliable. Browsers are buggy and may ignore the directive. Use the following two part method, which involves placing 2 lines in the page HEAD and four lines at the end before the final HTML tag.

Place this at the top between the <HEAD></HEAD> tags:

 <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
 <META HTTP-EQUIV="Expires" CONTENT="-1">

Please this pseudo head tag set at the bottom after then closing </body> tag and before the closing </HTML> tag:

 <HEAD>
 <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
 <META HTTP-EQUIV="Expires" CONTENT="-1">
 </HEAD>

And to resolve a final Netscape bug, use this Javascript in the body tag:

 onLoad="if ('Navigator' == navigator.appName) document.forms[0].reset();"