-
Notifications
You must be signed in to change notification settings - Fork 2.4k
deep linking with query parameters via the page-params plugin no longer working in 1.1.1 #4777
Comments
Most likely the hash is being passed directly to a selector without being sanitized. Hopefully this is a quick fix. I'll take a look. |
We're having trouble reproducing the issue. Can you put together a jsbin or jsfiddle for us so we can work with that? |
Crap...I see the issue and I don't think its a bug per se, so I'd first like to apologize for submitting the issue in the first place and thank you for looking at it so quickly. If you want to see whats going on browse to the URL below and then refresh the page...the error will occur Thanks again. |
Why don't you encode and decode the uri you're passing as the parameter value var url = "/foo/bar",
idAndQueryString = "#two?foo=" + window.encodeURI( url );
$.mobile.changePage( idAndQueryString ); Then when you can use |
@johnbender Guess this issue can be closed. Thanks. |
Post back if you still have issues. It's possible we still have a bug. |
@johnbender http://jquerymobile.com/demos/1.1.1/docs/pages/multipage-template.html#two?arg1=%2Ffoo%2Fbar In Firefox you end up with: "http://jquerymobile.com/demos/1.1.1/docs/pages/two?arg1=/foo/bar" which is garbage. |
Looks like this is a bug in Firefox where they store the decoded value in location.hash |
Instead of using location.hash, try this: This is how we get around the FF issue internally. It turns out that FF leaves location.href alone, but auto-decodes location.hash. So, if you use jQuery Mobile's URL parsing to get at the hash from the href, you'll get the hash undecoded. If this works for you, feel free to close the issue. |
@gabrielschulhof If you look at my comment above which states: In Firefox you end up with: "http://jquerymobile.com/demos/1.1.1/docs/pages/two?arg1=/foo/bar" which is garbage." Per your last comment, does that mean that location.hash shouldn't be used anywhere in the jqm codebase? |
@gabrielschulhof |
That is exactly the point. |
@gabrielschulhof |
@toddparker @gabrielschulhof @mruffolo This issue was corrected in master, and I've cherry picked over the corrections to fix the problem with firefox's autodecoding of the hash. You can give this a try by using the latest from our 1.1-stable branch <script src="http://jquerymobile.com/branches/1.1-stable/js/"></script> |
As a side note there will be another updated to similar bits of code later today to address some of the older webkit browsers auto decoding |
@johnbender There were still a handful of places that were using the location.hash. I see there is a a second "new" way to work around this issue that was implemented, but I don't think its fully solving this problem and I don't quite understand why. Going back to an earlier post....I got this working myself in the 1.1.1 release by simply just changing everywhere that I also went through the stable 1.1.1 release and changed every Throughts? |
Not sure how I can show this with jsfiddle being that its only reproducible when URL is changed...maybe I'm not familiar enough with jsfiddle to accomplish this, I'll see if I can come up with something. Though, as I've stated a few times earlier, you can see my issue by putting this URL in Chrome/IE and then in Firefox....it doesn't work in Firefox Regarding the location.hash only having one more reference, I just found the following areas in the 1.1 stable release where I think the location.hash should be changed to use the
|
Creating two jsbin's normally works. |
@johnbender @toddparker |
I don't see how this is possible to do in jsbin/jsfiddle I wrote a really simple app to demonstrate the issue:
Try this in IE or Chrome and it works fine. |
@johnbender |
@gabrielschulhof Try this URL instead.... http://home.comcast.net/~mruffolo02/ |
Is this still an issue with latest code? |
@uGoMobi |
closing this issue the official stance has always been this is not supported and we have decided that as of 1.5 we will allow any valid id for embded pages this means ? is a valid character for an id so the params will stay in link however they will not be treated as query params they will be treated as part of the ID |
@mruffolo I know this is an old issue but I built a plug-in for jquery mobile 1.4+. I could probably easily add support for 1.3 and maybe even 1.2 if people needed it. |
@CameronAskew thanks for the info, but we've since abandoned the use of jqm because of this and a few other reasons. If we ever consider going back, I'll keep this in mind. |
It seems the changes described as
"Init: Proceed to hashchange handler when the initial hash contains a path" re: "34c4811"
throws a syntax error if the deep link contains parameter argument such as http://localhost/#page?arg1=value
The error is "Syntax error, unrecognized expression: ?arg1=value"
The text was updated successfully, but these errors were encountered: