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 index 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: hashbang vs hijax.

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

share

merged by John Conde Apr 26 '11 at 11:47

this question was merged with Hijax == sneaky Javascript redirects? Will I get banned from Google? because it is an exact duplicate of that question.

migrated from stackoverflow.com Apr 7 '11 at 4:31

This question came from our site for professional and enthusiast programmers.

Browse other questions tagged or ask your own question.