Since Google crawls hashed links (by adding an exclamation mark after the hash: #!, for details go to
http://code.google.com/intl/en/web/ajaxcrawling/docs/specification.html) I tryed to figure out how it could be possible to realize this with the jquery-mobile API and especially without the unnecessary 301 AJAX request I am faced with. I couldn't find a clean solution. For me it looks like this isn't considered by the current implementation yet.
Here the details: It's possible to add an exclamation mark at the beginning of a link, e.g:
- <a href="!a/b/c.html>link</a>
BUT, the AJAX-call which is now executed tries to resolve following (wrong) URL, which returns a 301:
http://mywebsite.com/!a/b/c.html
Afterwards another request (the correct one) is automaticall executed:
http://mywebsite.com/a/b/c.html
To solve this for the moment, I hacked the source code by removing the questionmark out of the fileUrl. So now the correct request ist executed immediately. Sure it's not nice to modify the source but it was the only way I was able to avoid the unnecessary request:
- $.ajax({
- url: fileUrl.replace("!",""),
- type: type,
- data: data,
- dataType: "html",
- success: function( html ) {
- ...
- }
- });
Back again to my question: is there an elegant way to realize google crawlable hashed urls without executing the unnecessary request by using the default API of jquery-mobile or at least without hacking the source code?