azicchetti / jquerymobile-router

A router/controller for jquery mobile. Also adds support for client-side parameters in the hash part of the url. The routes handles regexp based routes. This plugin can be used alone or (better) with Backbone.js or Spine.js, because it's originally meant to replace their router with something integrated with jQM.
GNU General Public License v2.0
402 stars 69 forks source link

DefaultHandler does not work #60

Closed mrbhandari closed 12 years ago

mrbhandari commented 12 years ago

Hi - First of all thank you for putting this code out there - its been very helpful.

I'm trying to implement DefaultHandler and noticed that testAjax.html included in the example files does not actually call DefaultRouter. What is the correct syntax?

Thanks

mrbhandari commented 12 years ago

Sorry meant to add if you go to textAjax.html and then testAjax1.html ... the DefaultRouter is not called and the page is not found

azicchetti commented 12 years ago

Hi @mrbhandari, the default handler doesn't get called when you reference a non-existing page. In that case jQM will handle the error displaying the classic "error loading page" overlay.

However, default handlers are called when you go to an existing page that isn't matched by any route.

If you want to see an example of this behavior:

    * create a __subTestAjax2.html page
    * add a link to the the newly created page in testAjax.html
    * click on the link

The default handler will get called 'cause __subTestAjax2.html is not matched by anything.