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

jQM 1.3.0 #68

Closed ghost closed 11 years ago

ghost commented 11 years ago

Is it save to upgrade my app to jQM 1.3.0? Are there any know issues with jquerymobile-router not listed here?

azicchetti commented 11 years ago

Hi, no, I'm uploading the new version in a few minutes. I've not tested it thoroughly but it seems to work.

azicchetti commented 11 years ago

Hi, this issue should be solved by jquery mobile guys, I was hoping they could fix it for the 1.3.0 but it seems they didn't. https://github.com/jquery/jquery-mobile/issues/5230 https://github.com/jquery/jquery-mobile/issues/5085

To sum this up, we asked for native support for hash parameters in jQM and they added it in 1.2.1, but there were problems because it wasn't working for deep links.

I'll look into the new jQM APIs to find a way to temporarily support them by patching the router.

saesh commented 11 years ago

Oops accidentally deleted my post. For the record: After clicking a link like #foo?bar=baz the url parameter was gone.

I am setting the url paramter now in the router with location.hash = #foo?bar=" + getParams(match[1]).

Edit: My method is not a good approach, the history is all messed up.

azicchetti commented 11 years ago

We have to try the new method: http://api.jquerymobile.com/jQuery.mobile.navigate/

I'm positive we can temporarily fix this problem by using that one, but I'm at work now, I'll try a couple of things in the weekend and get back to you.

It would be great if you could test that method in the meanwhile. Thanks!

saesh commented 11 years ago

Yeah, I noticed that method too. I will play around with it.

After looking at it: $.mobile.navigate('#foo?bar=baz') ist the way to go but I can't get it to work so the browser and JQM history are in correct state.

azicchetti commented 11 years ago

I think I've found a simple patch to retain hash parameters. I've pushed it to the git, hopefully this solves the problem until jQM guys fix it on their end.

saesh commented 11 years ago

Thanks, I will check it out.

saesh commented 11 years ago

Works like a charm. And a easy solution too, even without $.mobile.navigate(). Thanks!