homepage Welcome to WebmasterWorld Guest from 54.237.125.89
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Hash Bang Url for Ajax Sites
Is this necessary to use hashbang url on ajax based sites?
Evercome Shathees




msg:4398628
 1:30 pm on Dec 16, 2011 (gmt 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.

 

Skier88




msg:4400721
 1:17 am on Dec 23, 2011 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved