Traffic Lounge
Lesson #25
Layers of Optimization #2: Layer Behaviors
Written By Cyndalie
In a previous lesson, we covered how to use HTML Layers for the purpose of optimization for the search engines. We talked about why varying the use of optimization "tricks" is important and evolving these will help your pages stay above the competition. This article is meant to inform webmasters of some new ways you can include indexable content in your page (especially for graphically heavy tours, flash, and sites with dynamic content which you cannot modify the current site design), in turn giving the search engines exactly what they are looking for.
The concern back then was the possibility of search engines wising up to detect negative values in the layer, which pushes the layer off screen therefore invisible to the user. Another concern was the amount of content held in the layer as well as using text colors matching the default background colors in the body tag of the page.
As optimizers are always trying to get as many pages indexed and ranking for relevant search matches as possible, we need to keep pushing the bar in ways to both please the engine and please the user. I have discovered a new technique when it comes to using HTML layers for optimization purposes, and I'd like to share this ideas as it may lead and help you grow in your strategies and needs as a webmaster.
Using Macromedia Dreamweaver you can apply behaviors to layers and other elements of your page very easily. If you'd like to try avoiding using negative layer values you can tell the layer to hide upon loading of the page. Since "onload" commands are usually only associated with design needs, it is not commonly used as an optimization technique (yet) and therefore not used for this purpose enough to be detected as abuse or "cloaking".
To do this using Dreamweaver, add a layer to your page. (Insert < Layer) Open/View your Behaviors window, select your Body tag, and click the plus sign (+) in the Behaviors window. Then select Show-Hide Layers. Select the name of your layer and click "hide" and OK. The default "Event" is "onload" which is what you want. If you don't see it than select it from the Events menu.
When you preview your page you will see the layer turn immediately off when your page loads. If you want to go even farther to make it invisible be smart. Set a background for your layer as an image (color) matching the background of the part of the page the layer will be on top of. You can use HTML layers that hide to show text links if you use a graphical menu or as an addition of a linked "alt tag" over an image link. There are a number of ways to use this be it for more spiderablilty of keyword friendly content on a graphically heavy site, or to cross link text between your optimized pages/domains.
Since this code required a pretty hefty JavaScript, try remotely hosting it in a text file or calling it as an include in your page so that it does not affect your keyword density or spiderability too much.
The following is HTML code you can copy and paste into a blank HTML page to experiment with hiding layers on page load:
<HTML>
<HEAD>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/HTML; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
</HEAD>
<body onLoad="MM_showHideLayers('Layer1','','hide')">
<div id="Layer1" style="position:absolute; left:57px; top:59px; width:198px; height:90px; z-index:1">
<p><font color="#FF0000" size="2" face="Arial, Helvetica, sans-serif">This is a layer that hides when the page loads using a Behavior.<br>
<br>
Extra keyword content and links</font></p>
<p><font color="#FF0000" size="2" face="Arial, Helvetica, sans-serif">Move farther down the page to avoid being seen by user.</font></p>
</div>
This is your static HTML page
</body>
</HTML>
[Authors Note: This is a simple trick and mean as an option when optimizing a page. Use discretion when using any optimization trick and always use in moderation. Overuse/abuse of any one tactic will only hurt your efforts. Make well-rounded decisions in every step of your marketing campaign.]
[ <- TRAFFIC LOUNGE | POST THOUGHTS | E-MAIL LESSON | NEXT LESSON -> ]