Forum Moderators: Robert Charlton & goodroi
Trouble comes when the target url is generated via javascript and not available within the vanilla html portions. And if you think about it, there's no reason for a javascript rollover to get anywhere near the url of the link - it's only swapping images, after all.
However, for your end users, I still feel it's better to generate "rollover" behavior with CSS hover rules. You can swap out background images and still use actual text for the link. This also keeps your html code much leaner.
Google will not give you credit for that link when it comes to PR, nor will you get any credit for anchor text if it is not a straight forward <a href link.
If you are going to be playing with JS links, make sure you test your code in all browsers.
I'm looking at a site for somebody, and there seem to be multiple issues causing spidering of the site to suffer.
On each product category page, they have links like this
<a onclick="openEnlarged(1026)" href="#">
that create a popup window with the individual product info.
I don't use javascript if I can help it, so I'm not sure, but that's not 'the good kind' of javascript link is it?
They also have a nav menu that relies on an external file, I don't think it's working too well for the bots either.
A better way to create the same effect (if you wanted the information spidered) would be to open the real target in a new window and specify the size and style of the new window with Javascript. It is also common (and courteous) to add an informative bracket after the link saying something along the lines of "(opens new window)".
My experience has been that external Javascript files have no effect (or a possibly beneficial one because of reduced on-page code) as long as the URLs are not embedded.
The URLs that go with the nav menu appear in a <script> a the top of the page, and look like so
Menu1=new Array("example","home.php?com=showThisCat&cat=8","",0,19,174);
The sim spider can't seem to see these, but maybe Gbot will?
[edited by: Spine at 7:16 am (utc) on June 29, 2005]
<TD
width="86" valign="top"><a href="AboutUs.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('menu-about us','','images/menu.jpg',1)"><img src="images/menu-AboutUs.jpg" name="menu-about us" width="86" height="41" border="0"></a></TD>
<TD
Thats the way Dreamweaver generates the code, and the "<a href = " is definitely inside the javascript code (which is at the top of the html coding and not in the actual body of the page. Does that make this a bad link, as far as spiderability is concerned? I have custom images these rollovers use, and my site is an art based site, so aesthetics are everything to me.
One solution I was toying with was making hidden layers underneath each rollover image with a plain text link that only bots would follow, but users wouldn't see. This would be used completely as a safeguard. As long as the links and titles of the links were accurate would this lead me down a road of problems? Even if these "hidden links" accurately represented the pages, could malicious competitors use an employed tactic such as that to get me in trouble with the search engines? I'm most eager to just get my javascript rollovers spiderable though.
<a href = " is definitely inside the javascript code
Not in what you just posted. The javascript there is only the two event handlers (onmouseover and onmouseout) and they are INSIDE the anchor tag - the anchor tag is not inside the javascript. However, if there is an open <script> tag before that url and the matching close </script> tag is after the anchor element, then there is a problem.
<a onclick="openEnlarged(1026)" href="#">
The challenge here is the 1026, which I assume pulls an actula url from somewhere. If you have a tag like this:
<a onclick="openEnlarged('page.html')" href="#">
...you can make it spiderable (and have it pass PR, anchor text influence, and so on) like this:
<a onclick="openEnlarged('page.html');return false;" href="page.html">
enu1=new Array("example","home.php?com=showThisCat&cat=8","",0,19,174);The sim spider can't seem to see these, but maybe Gbot will?
Googlebot "may" try to spider anything that looks even remotely like a url - no matter where it is found. But even if such hidden urls do resolve for Gbot, you still get no PR passed and no anchor text influence.
This type of poking around happens with the version of Googlebot that Dijkgraaf mentioned in message #2 - not the regular crawler.