On the Backbone.js page:
Until recently, hash fragments (#page) were used to provide these permalinks, but with the advent of the history API, standard URLs (/ page) can now be used .
I tried to add this router rule:
routes: { 'test': function() { alert('ok'); } }
And called Backbone.history.start({pushState: true, root: '/myroot/'}) . I have a link on my page:
<a href="test">test me</a>
I intercepted the link click event:
$('a[href=test]').click(function(e) { router.navigate('test'); e.preventDefault(); });
When I click on the link, the request is not created, and I believe that the interception was successful. But the event does not fire.
So, please help me understand how this History API works. Or indicate where I made a mistake.
davidshen84
source share