HTMLfixIT.com Copyright JavaScript snippet.


JavaScript Copyright notice version 2.

The goal of this snippet, is to display the Copyright notice and update the date via JavaScript.
The Difference between this version and the first version, is that this one will still display a Copyright notice even when the users browser doesn't handle JavaScript, or has it disabled. Some examples of this would be browsers like Lynx, or Links, people with Internet Explorer that have turned off active scripting to block security flaws and automated spiders like the Gogglebot that scan a page to record their content, all of these examples are places where you really should still be displaying a copyright notice.

This script will work fine in Mozilla/FireFox/Netscape6+, Internet Explorer 4+ and most other modern browsers as well. As an added benefit, it works on the archaic Netscape 4 also.

An example of the output of this script is below:


And if the browser has no JavaScript support for whatever reason, the user will see the fallback notice, like below:

Copyright © 2000 HTMLfixIT.com


The beauty of this version, is that if the browser won't or can't run the JavaScript, it falls back to a hard coded HTML version of the copyright notice, meaning that in no case will you be left sans the notice.

Onto the install instructions.

Only 3 simple steps to add this script to your page.

Step 1.
The first step is to insert the JavaScript function below between the <head> and </head> tags on your page.
Before you save the updated page, find this line in the new JavaScript:
var copyrt = 'Copyright © 2000-' + nyear +' MyCompany';
and edit the start date (2000 in the code by default) and company name to match yours.

Step 2.
Now we need to tell the script to run immediately after the page is loaded. To do that simply replace your HTML <body> tag with the one below.

Step 3.
Finally, all that is left, is to insert the line below where ever you wish the copyright notice to be displayed.
Be sure to edit the years and replace "MyCompany" with either your name, or your companies.


That's it!
Congratulations, you now have a copyright notice that is always up to date, and one that will still display even when the web browser it is running on can't handle the JavaScript.

Return to JavaScript snippets page



Valid XHTML 1.0!