PDA

View Full Version : Handle built in back button



Rohall
23 Jul 2010, 8:18 AM
Hey guys!
Do any of you have a good method for handling clicks on the browser back button? After a bit of testing it seems a lot of people still attempt to click it and are taken away from the page. Any help would be greatly appreciated. Thanks!

meyerovb
23 Jul 2010, 10:09 AM
Handling history in an ajax page has been an issue for years... From what I've seen the best idea is to manage history through anchor points, so for every card switch or nested list tap, you redirect the browser to [yoururl]#page[increment] and then the back button will automatically go from page to page. There are libraries that help you manage it too, I know microsoft has something in their ajax library, and a quick search found a recent github maintained jquery plugin with a good support matrix.

Rohall
23 Jul 2010, 10:11 AM
Thanks meyerovb! I've used a similar approach on full sites and I think you're right about this being the best method for mobile as well.

Have you implemented this by any chance? I'd love to know if it caused any performance/animation or other issues! Thanks again!

meyerovb
23 Jul 2010, 10:16 AM
I don't think anchor redirects will affect the ui since the layouts are usually based on static screen sized scrollable divs. Usually anchor redirects scroll the page as a whole back to the top if the anchor doesn't exist, but since the page itself never scrolls, just the components (as long as you're designing within the framework) it shouldn't be an issue. Performance impacts are a non issue because nothing is actually happening, and it's usually a 0 millisecond operation. You just have to be careful about functionality... now you have to catch the history events and transition your cards appropriately... which is why it's too much trouble for most developers to deal with :)

Rohall
23 Jul 2010, 10:19 AM
Perfect! Thanks again!