Reputation: 20503
I'm trying to implement a decent navigation in a AJAX application. What I am doing right now is the following:
The third point is a bit annoying: I'd rather not have a timeout every 500ms just to check the hash, as most of the time it will stay the same.
Is there a better way to manage this? I cannot think of any alternatives, but maybe I am missing something.
Please, do not point me towards ready-made solutions, unless you know they are based on a different mechanism.
Upvotes: 5
Views: 1044
Reputation: 4829
Use this plugin: http://www.asual.com/jquery/address/
The jQuery Address plugin provides powerful deep linking capabilities and allows the creation of unique virtual addresses that can point to a website section or an application state. It enables a number of important capabilities including:
Upvotes: 0
Reputation: 4812
maybe this is an interesting read, it is a ready made solution for the exact thing you are doing. and no, until the hashchange is properly supported in every browser (read: ie), you will have to check manually
Upvotes: 0
Reputation: 11159
There is the "hashchange" event, which is to be implemented in HTML5. I'm not sure how good support is now... IE8 supports it, and I think Mozilla have their own implementation in a recent release. Other than that, there is nothing I'm afraid. Checking exery x ms is the way everyone does it.
Upvotes: 5