Jump to content

Recommended Posts

 

I'm a little confused as to how google and other search engines will respond to this...

 

<a href="blog/some_stuff.html">some stuff</a>

 

The above link is a basic link to a target. My understanding is that google will follow the link and cache the target accordingly.

 

However what will happen when i place some javascript event listeners on the link. Something that would say, display the contents of the target in a div overlay on the same page the link resides. Would google still be able to follow and cache the link? Or would google simply ignore the link completely thus not really caching the target at all?

 

I am trying to achieve an ajax type effect on a blog but still have each post on the blog be its own html entity... thus if google or someone did go a specific blog post the link would still work in its own right and have content.

 

 

Link to comment
https://forums.phpfreaks.com/topic/262654-googles-response-to-js-altered-links/
Share on other sites

It's possible that Google SE reads HTML and executes JS just like a browser does (except there will be no UI). In most cases this also means it follows the correct path (fallback to href when onclick does not return something usable for example).

The general rule of thumb is that search engines do not understand Javascript and as such it has no effect on your page when crawled.  So as long a you have your href pointing to the desired url instead of doing something stupid like href="javascript:blah();" then they will follow it properly.

 

I believe google (and maybe some others these days) do support some limited javascript now, basically just enough to catch redirects and some of the basic stupidities that some webmasters do (ie, <a href="javascript:void();" onclick="location.href='whatever.html'">).  There's a chance google might process your onclick but when it sees that your making an ajax request for a URL it will add that URL into it's crawler queue so you should be ok either way.

 

Yea I have noticed some sites i have made with ajax content is getting cached by google.. this was my worry: That google would mess up on the "blog links".

 

Thanks. I will build something on the premise that google will cache the actual targets and see what the results are.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.