Using url with /#!/ like twitter does - ajax

Does anyone can tell me about what are urls like blablalba.com**/#!/**dasdas?
Twitter use them.
I have a problem with requesting page using AJAX, when I hit Back button, it doesn't load previous page that loaded using AJAX.
But, I saw in twitter, when you are in Timeline tab/page, and click #Mention tab, and hit Back button, it will bring you to Timeline tab/page again not to your previous loaded page (non AJAX). is there a relation between it and url with /#!/ characters ?

I am not familiar with Twitter, but your description reads a bit as if you were looking for Chris Coyer's screencast on using the hash fragment from JavaScript.

Related

MVC Ajax form and browser back button

I am currently working on an MVC site which has a search page that sits behind a login page. When the user logs in, they are redirected to the search page.
The search form uses an ajax form that returns search results to the same view.
When we have search results, the search form is no longer shown. This all works fine.
However, once you have fired off the form and have search results - the user will probably try and hit the browser back button to try and get back to the search form. Of course, this instead takes them to the previous page (the login page).
So, my question is this - I would still like to keep the form and results on the same page using ajax. Is there anyway that I can achieve this, in conjunction with when the user clicks back, it takes them to the search form?
I appreciate I am probably asking for too much here, but I thought I'd put it out there anyway!
ps - I already have a 'back to search' link which re-loads the form. I believe the average user will try and click the browser back button. I would also rather not have some sort of function on the login page that redirects them back to the search page.
You need to use the History API. It's supported in modern browsers, and there's a polyfill for IE9 and below.
UPDATE
For what it's worth, I agree with #TravisJ. This is a bad design, but if you insist on going down this path, then my notes above apply.

how does usatoday display URI for news docs?

I am developing a web app/message board in AJAX. Ive come to the part where I need to decide how to display threads.
Should I refresh a completely new page for each thread? Or load it via AJAX. Obviously, I want each thread to be crawlable, linkable, and saveable as a favorite in your browser.
Then I saw USAToday's website (www.usatoday.com/news). Its very interesting how they load the page through a popup window, change the URI, and keep the data in the background.
This is exactly what I want, but I don't know what they are doing.
Can anyone else decipher this or lead me down the right path?
My impeccable googling skills has led me to believe that the answer lies in pushState.
http://www.seomoz.org/blog/create-crawlable-link-friendly-ajax-websites-using-pushstate
Essentially, it appears they are...
using the HREF of the provided link to change the URI via pushState.
using AJAX to load the contents of the page accessed via the link.
on close, they most likely use data from the newly loaded page to figure out what section its was under(sports, entertainment, etc), and reload that page.

How to do ajax loading with URL change but not page redirection?

If you carefully notice facebook, you will understand that the when you visit one page to another then the whole page is not refreshed or redirected but the URL changes when navigating to new page. It is more clear when chat windows are open, they remains static during page loading. As other website does this by using the # but facebook does not.
There is another example came to me: http://www.davidwalsh.name/. Visit the site and open other pages within their site and you will understand what I mean. Don't forget to notice the URL change.
How they do this?
Added More: I want a way that the page content will be loaded with ajax, change the URL for bookmark feature but when changing URL it should not reload / refresh the page by not using # (hash).
You have two questions:
For the URL change you can put the path instead of the # in the href property of the anchor (e.g /otherlink).
For opening the chat or opening some div does not require to send it in the url, its the onclick event on the div and its expands. Also the chat remains open may be thay set cookie or flag when the chat is first time opened and checking and changing the chat with flag they are setting.
As suggested by #andytuba
For Facebook, Google "hash navigation ajax".
For DavidWalsh, google "history API".

Ajax Website does not load Google-Maps correctly

I use an ajax plugin (smartAjax) for my website and on one of my pages, I have google map. All is working perfect without using ajax but as soon as I use google map in combination with ajax, google map does not load correctly anymore.
You can view here:
http://mark-i-mark.com/lab/eys/public/ajax1.html
All looks great but when clicking on "SCHEDULES & FEES" in the top menu and then clicking on "OUR CONCEPT", which suppose to bring you back to the map, the map does not appear anymore. If you refresh the page, you can see a short flash of it but it does not load correctly.
This is about the address, as shown in the address bar because if you delete the last part (#ajax1.html), the map appears correctly.
Does anybody have any idea what I may do wrong? I am happy about any suggestions.
cheers ;-)

How does a website load only part of the page and still display full on URLs?

I am looking at the Gawker blogs (http://io9.com, http://lifehacker.com/) and I'm curious about how they are made.
When I click for on a link only the article part of the page reloads displaying a loading icon while it does.
But what I can't figure out is that links point to new URLs like io9.com/something/something and its not something like I see on ajax pages that they put a site.com/#something tag at the end of the url from javascript to mark the page after an ajax request.
Can I change the full blown URL from javascript or what is happening?
When it happens, the website is using the HTML5 History API. This API can change the url (via JavaScript) without changing the page.
See caniuse.com for browser support.
If you would like to implement it in yout website, backbonejs.org would be very useful.

Resources