New Link Markers
Here is a way you can put “New” markers next to links that you have added or changed since your visitor last viewed your web page.
Now you can call attention to links your visitor hasn’t yet had the opportunity to see, without bothering visitors who have already seen them.
Here are the steps:
- Specify values (or verify that they are already correct) in three clearly marked spots in the source code.
- Put the source code into the HEAD area of your web page.
The cookie specifications allow domains to store up to 20 cookies, and up to 4 kilobytes per cookie. See http://www.netscape.com/newsref/std/cookie_spec.html
Browsers may allow more than the specifications, but the relaxing of limitations can’t be depended upon.
It also means that when the links on a page exceeds 4 kilobytes, including the URL of the current page (which is part of the identifying cookie name), then some of the links might not be stored in the cookie. 4 kilobytes is a lot of links, but if you have a links page then you might exceed the limit.
To give you an idea of how many links fit in 4 kilobytes (4800 characters), here are two examples:
- The link href=”nextpage.html” is 13 characters long. Adding 1 character used when the cookie is stored, allows 342 of those links to fit within 4 kilobytes.
- The link href=”http://willmaster.com/master/” is 29 characters long. Adding the 1 character padding, 160 of those links fit within 4 kilobytes.
41 additional characters are required for the cookie expiration date and the cookie name.
Here are expanded instructions for implementing the “New” link marker system.
The demonstration page at http://willmaster.com/a/18/pl.pl?art184 has links to the source code.
Save the source code to your computer.
You’ll notice that the source code is a web page. You can use that web page and modify it for your own use or you can modify one of your existing web pages. The following assume you’re modifying one of your existing web pages.
Specify Values In the Source Code
- You can specify what the “New” markers are. They can be the word “NEW” or an image or anything else that can be printed on a web page.
- You can specify how many days the cookie shall be stored on the visitor’s computer. The number shall be at least 1 and no more than 3652 (which is 10 years).
Example (183 days for a cookie existing 6 months):
CookieDays = 183;
- Specify the number of seconds it takes for the web page to load.
It is necessary that all links are loaded in the browser before the new cookie with current links is set. The cookie setting will be delayed for the number of seconds you specify here.
When determining the number of seconds for loading your web page, consider that some may access your page with a dialup account or with a cell phone. It is better to over-estimate by a few seconds than to under-estimate.
Because the load time will vary from visitor to visitor, an estimate is the best that can be done.
LoadTimeSeconds = 12;
Put the Source Code Into the HEAD Area
This example puts the “New” marker in front of the link:
Notice that the URL between the quotation marks, in both the IsNew() function and the href= attribute, is exactly the same. They must be the same URL so the “New” marker knows which URL it’s supposed to be associated with.
Here are three other considerations:
- All URLs that you intend to work with the “New” marker must be absolute http://… URLs.
Some browsers store URLs as absolute URLs, internally, regardless whether or not the source code uses relative URLs. Use absolute URLs to work with the greatest number of browsers.
- The domain name following http:// must be all lower-case.
Some browsers store the domain name in lower-case, internally, regardless of how the source code is printed, and some do not. Make all domain names lower-case to work with the greatest number of browsers.
- Any URLs that end with a domain name or directory name must have the slash character (“/”) at the end of the URL.
Some browsers append a slash character to the URL unless the URL ends with a file name. End all URLs with a slash character, unless it ends with a file name, in order to work with the greatest number of browsers.
Here are examples of href attributes with correct
This example puts the “New” marker after the link:
Other places where the “New” marker might be appropriate is before, after, or within a description paragraph.
To test your page, first remove all links and load the page into your browser. To make it easy, you might cut the entire BODY area of your page and paste it to a temporary file.
After you’ve determined that all of the “New” markers appear where they’re supposed to, load the page again. This time, all of the “New” markers should disappear because none of of the links are new to your browser. If any remain visible, check the three “other consideration” points, above.
When you have it working for one browser, check it with other browsers. Opera 6 and IE 5 are the most picky of the browsers I’ve tested. If you pass with those, you should be okay with others.
If you need to test more than once with the same browser, you’ll need to remove the cookies before subsequent tests. A way to do it without removing cookies is to rename the web page file you’re testing. Renaming means a different cookie will be used.
Consider the limitations and follow the five implementation steps. You’ll have “New” link markers custom printed for each of your site visitors.
“WillMaster Possibilities” ezine