Hijax == sneaky Javascript redirects? Will I get banned from Google?
Posted
by
Chris Jacob
on Pro Webmasters
See other posts from Pro Webmasters
or by Chris Jacob
Published on 2011-04-06T05:34:11Z
Indexed on
2012/06/04
4:48 UTC
Read the original article
Hit count: 290
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
- 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).
- 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
index.html
page contains all OUTER html/css/js... the site's template.index.html
has a<div id="content">
which defaults to containing the "homepage" html.index.html
has a navigation menu, with a Hijax link to an "about" page.- With JavaScript disabled (e.g. crawler) it follows link to
/about.html
. - 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.
© Pro Webmasters or respective owner