Link
Colors
by kirupa
A link color is simply the color any
hyperlinks on your site are. The default color is blue, and
numerous sites ranging from Yahoo to Google employ that. Of
course, HTML allows you the flexibility to change the link
colors to various colors such as what you see on this site.
Besides learning how to change the link
colors, this article will also show you how to change the
color of a selected link, a visited link, and the
ever-popular hover link.
The Code:
[ copy the above code into a
detection page
] In your HTML page
that you want to have your script, copy and paste the above
code. When you save and preview the page in your browser,
you will not see anything happening just yet. You will need
customize it a little bit though.
When Page Is Entered
If you want the browser to be detected immediately once the
page has been entered, add the following line to the end of
your code:
checkBrowser();
The above
method is probably the most popular, and more than likely,
you will be using the above method in your site. A few other
methods and customizations are mentioned below:
Detect on Click
You can also have the browser detection script work only
when a user clicks on a link. For such a scenario, use the
following line of code in your HTML document where you want
the link to be displayed:
<A HREF="javascript:checkBrowser()">Click to Check Browser</A>
Of course, if you
observed the code, you will need to create individual pages
for each of the browsers with the names specified such as
ie.html,
opera.html,
oldns.html,
and newns.html.
You can save some time by simply creating one html page for
alternate browsers and tell them all to go to that page
instead:
[ just a minor modification to the above script ]
No-Redirect for IE
If you are fairly savvy with JavaScript and are familiar
with a lot of the features, you can customize the script to
your full liking. For example, let us take Internet Explorer
as our target browser. If you want everybody who is using
Internet Explorer to stay on the current page instead of
being re-directed to a different page like ie.html, simply
delete the following lines from the code:
else if (IE) {
window.location = "ie.html";
}; Experiment and try new things
with this script! I hope this information
helped. If you have any questions or comments, please don't
hesitate to post them on the forums found by clicking
here. Regards,
|