I have a treeview inplemented in CSS, when a user clicks a folder on the treeview I’d like to update the URL in the address bar without causing a server round-trip.
The HTML looks a little like this:-
<ol>
<li>
<a href="www.example.com/blah?id=12345">Folder</a>
<ol>
<li>Child</li>
</ol
</li>
<ol>
The CSS I have handles the expanding of the folder but I’d like the Address bar URL to update so I can deep link to a particular folder but there is no need from a code perspective to do a round-trip to the server
Is there any way of achiveing this? I have a feeling this might be impossible because of potention phishing??
I’m using HTML5, CSS2/3, jquery and ASP.NET MVC3
Yes with HTML 5 History API it is possible, as is done on gawker sites and on github. But the condition is that both the pages be from same server. Like you can change the address from:
to:
using
history.replaceStatefunction. It is not widely supported in all browsers (caniuse). Your best bet prehaps is to use history.js