Forum Moderators: Robert Charlton & goodroi
I'm curious to know how Googlebot handles on-page Javascript. By that I mean scripting not separated to to a .js file.
When people say the it can "read their links" in the script, do they mean links written explicitly or can Googlebot even handle functions that create links from arrays or similar?
I want to append querystrings to a set of links as the page loads. Nothing sneaky about it, it's purely to change the CSS on the page they link to, but it's a potential dupe content penalty if G can read the querystrings. The pages are all HTML, so it's all done with Javascript, such that any robot will see only the "base" link on the page, without the added querystring. I'm fairly sure this won't be picked up by G, but I'm wondering what others have experienced with this kind of thing.
The issue you probably will run into, sooner or later, is that a link with the query string attached will get posted somewhere on the web and googlebot will follow it. Then you could have problems.
I remember reading somewhere the Mozilla GoogleBot may be reading/executing JavaScript. I cannot remember where I found the information though, so I have nothing to 'back-up' the claim. Just something I remember sticking with me, so it might be good to keep in mind when designing.
Justin
The issue you probably will run into, sooner or later, is that a link with the query string attached will get posted somewhere on the web and googlebot will follow it.
Exactly, that's a point! I've solved this problem with very sophisticated way - I put the js generated query to hidden field in a form and submitted the form with POST method. So there are no URL with query anywhere.
So there is a form with hidden field named 'query', and js function which sets the value of this field and submits the form. This function is called from onclick event on links, so for the user it looks like there were normal links with no sophicticated stuff anywhere.
My site with this trick worked for over a year with no Google penalty, but now I'm going to put Adsense on it so I'm cleaning it up to avoid a risk that it could be deemed against Google guidelines :)
Why would it be against Google guidelines? I'm just trying to make the visitor experience more interesting by adjusting a page appearance according to link choice. Nothing "black hat" involved or whatever you want to call it.
Thanks