Wednesday, December 11, 2024

Hiding Your Meta Tags

Share

Serious web sites spend a lot of money and effort getting premium placement in the search engines. One of the most popular ways that search engines index your site is to look for META tags in the

of your page, as shown below:

<html>
<head>
<meta name=”Keywords” content=”Important phrase or keyword, another one, some more”>
<meta name=”Description” content=”A full description of your site goes here.”>
</head>

(For more hints about how to use these tags, try one of my favorite resources…see below.)

Why hide them? Now to the point of this article. These keywords are valuable. You spent a lot of time investigating what works best. Your competitors want to know what you use, so that they can steal them! I recently saw yet another article about how to stop the right-click working in Internet Explorer (ignoring the fact that View/Source is still available on the menu), and that prompted me to show you a better way to hide your precious META tags, or anything else for that matter.

See my Time/Date example and my Debug page (see below) for other ways to serve up dynamic content.

OK, I wanna do it. How? It’s easy as ABC with ASP. Have a look at the source below, wich appears in my Header function. (You can get the full source code by clicking on the icon at the end of the article)

var sBrowser = “” + Request.ServerVariables ( ‘HTTP_USER_AGENT’ );

if ( -1 == sBrowser.indexOf ( ‘Mozilla’ ) && -1 == sBrowser.indexOf ( ‘Opera’ ) )
{
// an unknown browser – probably a spider
Out ( ” );

Out ( ” );
}
else {
// a browser – show some junk to make them think we’re idiots
Out ( ” );

Out ( ”);
}

Not too complicated, eh?

The first line grabs the name of the browser, or at least what name it tells everyone. Looking through the venerable Browscap.ini you’ll see that every IE and every Netscape version since 1.0 called themselves Mozilla! The only “popular” browser that doesn’t is Opera, so on the second line I test for both strings. If either are present I output some junk META tags just so the visitor’s suspicions aren’t aroused. This is key, since there is an easy way to bypass this USER_AGENT check (if you know how). Of course, the spiders User Agent IDs aren’t as well publicized, so if you know of any that call themselves Mozilla or Opera please let me know, and I’ll make the test more sophisticated.

Update: “CoolMB webmaster from York” also left a very useful review on Aspin.com about this article. As he correctly points out you can go further with this by serving up different META tags for specific search engines. Something for you to complete as homework perhaps?

Thanks for the help with this article Beezle and CoolMB.

James Shaw (jameswork@shawthing.com) (CoverYourASP) (http://www.coveryourasp.com/)

Table of contents

Read more

Local News