Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Hash Bang Url for Ajax Sites

Is this necessary to use hashbang url on ajax based sites?

1:30 pm on Dec 16, 2011 (gmt 0)

New User

joined:Dec 5, 2011
posts: 26
votes: 0

I have a site which they have used Ajax application for search box on few pages. Is It necessary to use hash bang URL for Ajax based sites? If its necessary,should I use hash bang URL for all webpages or only on pages which they used Ajax applications?

I have another website (Site Page Rank is 4) which they didn't use ajax applications, Normal HTML website. but they created url with hash bang. can we redirects these urls to normal html urls (Eg: com/index.html#!/services to .com/services.html) or can we use the same hash bang url for promoting normal html site? So, if we can use redirection, there will be any changes occur on page rank, back links & link Juice?

Help Me on This.
1:17 am on Dec 23, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:July 30, 2009
posts: 130
votes: 0

Ok ... first off, it's just the "#" that matters - the "!" is of no significance. The hash symbol is used to indicate locations within a page, which is why you've seen it on pages without javascript. It is also why ajax applications use it to store their state: if only the hash string (portion of the url after the "#") changes, then the browser assumes you're navigating within the current page and doesn't reload the page (you would then load the necessary content via ajax).

Now, to answer your question: no. Javascript methods to manipulate the url without reloading the page (https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#section_4) were introduced with html5, so you could use ajax (and store state) and never have "#" in the url. Of course, older browsers won't support this feature, but it's easy enough to test for it and fall back to something that is supported. The downside to this is that it would require a nontrivial rewrite of your website.

As for redirecting, I'm pretty sure the hash string isn't even sent to the server, so server-side redirects would be impossible. You could redirect client-side if the user has javascript but no ajax. I'm not sure how such a redirect would affect SEO, but I would guess it couldn't be a good thing. But if you use the html5 method above, you don't have to worry about redirecting because your urls will be the same whether the client is using ajax or not.

The only way you could could use hash strings with a plain html website is if the entire website is on one page, which would probably be a terrible idea unless your website is very small.