Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Question

Will I get penalised as "sneaky Javascript redirects" by Google if I have the following Hijax setup (which requires a JavaScript redirect on the page indexed by google).

Goal

I want to implement Hijax to enable AJAX content to be accessibile to non-JavaScript users and search engine crawlers.

Background

  1. I'm working on a static file server (GitHub Pages). No server side tricks allowed (so Google's #! "hash bang" solution is not an option).
  2. I'm trying to keep my files DRY. I don't want to repeat the common OUTER template in all my files i.e. header, navigation menu, footer, etc They will live in the main index.html

Setup the Hijax

  1. index.html page contains all OUTER html/css/js... the site's template.
  2. index.html has a <div id="content"> which defaults to containing the "homepage" html.
  3. index.html has a navigation menu, with a Hijax link to an "about" page.
  4. With JavaScript disabled (e.g. crawler) it follows link to /about.html.
  5. With JavaScript enabled (e.g. most people) the link updates the url hash fragment to /#about and jQuery replaces the <div id="content"> innerHTML with $("#content").load("about.html #inner-container");.

AJAX content

about.html does not contain anything extra to try an cloak content for crawlers.

about.html file contains enough HTML / CSS / JavaScript to display /about.html as a standalone page with it's own META data... e.g. <html><head><title>About</title>...</head><body></body></html>.

about.html has NO OUTER HTML template (i.e. header, navigation menu, footer, etc).

about.html <body> contains a <div id="inner-container"> which holds the content that is injected into index.html.

about.html has a <noscript> tag as the first child of <body> which explains to non-JavaScript users that they are viewing the about page "inner content" - with a link to navigate to the index.html page to get the full page layout with menu.

The (Sneaky?) Redirect

Google indexes the /about.html page. However when a person with JavaScript enabled visits that page there is no OUTER html template (e.g. header, navigation menu, footer, etc). So I need to do a JavaScript redirect to get the person over the /#about page (deeplinking to the "about" page "state" in index.html).

I'm thinking of doing a "redirect on click or after 10 seconds".

The end results is that user ends up on an "enhanced" page back on index.html with all it's OUTER template - but the core "page" content is practically identical.

Known issue with inbound links e.g. Share / Bookmarking

It seems that if a user shares the URL /#about on their blog, when allocating inbound links to my site Google ignores everything after the # ... it allocates value to the / page - See: http://stackoverflow.com/questions/5028405/hashbang-vs-hijax/5166665#5166665.

I can only try an minimise this issue offering "share" buttons on the page with the appropriate urls i.e. /about.html.

Duplicate

Sorry. I posted this same question over on http://stackoverflow.com/questions/5561686/hijax-sneaky-javascript-redirects-will-i-get-banned-from-google ... then realised it probably belongs more on this Stack Exchange site... Not sure if I should delete the Stack Overflow question? Or just leave it on both sites? Please leave comment.

share|improve this question
1  
How about if you provide the canonical url for the about page in its' headers? googlewebmastercentral.blogspot.com/2009/02/… –  nikc Apr 6 '11 at 8:11
2  
try a "fetch as Googlebot" in Google's Webmaster Tools console and "see" how google treats the page - you'll be surprised how sophisticated this so-called "blind browser" has become... –  Mike Hudson Jun 5 '11 at 22:13
    
I would not assume that Google is not JavaScript aware. Google can certainly interpret some JS these days, and that may well include a straight forward JS redirect. –  w3d May 17 '12 at 15:42
add comment

2 Answers

> Hijax == sneaky Javascript redirects?

only if they are intended as sneaky.

Will I get banned from Google?

if they are not sneaky, most probably not.

a "penalty" is an editorial or semi-editorial (a mini algo targeted at a small subsample of sites) action from googles side to .. well .. penalize spammy, malicious sites. so the get a real penalty you have to have a malicious intend. i presume that your site is legit, so lets strike the word "penalty" and look at the technical implications of your solution.

here is a short, simplified outline on how google processes your site see: pages not indexed by Google [stackoverflow]

discovery -> crawling -> indexing -> ranking (-> ux feedback)

a) google has a step called "ux feedback" in which it collects quality metrics on the site / page it did send traffic too. if you make an immediate redirect after the user reaches your site, it might break this step on the page level. (this is just a might, only a some specialized google engineers know for sure)

b) the other issue is, that users tend to copy&paste the URL directly from the address-bar, even if you over them "share / link to me" box. this URL from address-bar copy & paste behavior is hard coded into the well trained internet user by now, so there is no - easy - way to change this behaviour.

now some anecdotal "evidence": i once optimized a big job site in the austrian market which had these kind of ajax redirects. the site performed in the search engines, but not as good as the (non ajaxy) competition. only after these redirects were turned of (only the second page view was then done via some ajaxy magic)the site started to perform better. if this was because of a) or b) (we did see more direct links to the good urls) i can not say.

so maybe the "second page view via ajax" is a compromise you can go for.

anyway: for big comercial sites where the question of seo is a question of "to be or to be gone" the recommendation is still to not to any ajaxy urls, for everyone else: please do not care to much about seo, the internet is to much fun for it.

p.s.: the redirect after 10 seconds seems such a non ux thing to do so that i would not consider it. additionally the a) and b) issues would still be there.

p.p.s.: as for point a) i woud recommend posting it on the google forum http://www.google.com/support/forum/p/Webmasters/label?lid=41234c84d9491af8&hl=en as from time to time some humble engineers / google webmaster central guy are actually responding ... something)

share|improve this answer
add comment

I have had clients site drop out of the index because Google thought the JavaScript was suspicious. This normally happens when a programmer comes up with a clever method to do something shady.

My advice is this: If you have to ask, its probably a problem. Does it substantially improve the user experience? If not, why take the risk?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.