Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Deep linking in multi-page document fails when the query string contains a period #4493

Closed
hansjorg opened this issue Jun 6, 2012 · 4 comments
Assignees

Comments

@hansjorg
Copy link

hansjorg commented Jun 6, 2012

A URL containing a query string with a period (".") in it will cause initializePage to change page to $.mobile.firstPage, regardless of the actual page linked.

A period is a valid character in a URL and shouldn't have to be percent encoded.

Fails on jQuery Mobile from git (e5140e1) on iOS 5.1 Safari, Firefox 12 and Chromium 18.

Works with 1.1.0.

Example with two pages (#first-page and #second-page):

http://jsbin.com/oxosev/

Deep linking to #second-page (works):

http://jsbin.com/oxosev/#second-page

Deep linking to #second-page with query string (works):

http://jsbin.com/oxosev/#second-page?param=abc

Deep linking to #second-page with query string containing period (doesn't work, shows #first-page):

http://jsbin.com/oxosev/#second-page?param=abc.def

@ghost ghost assigned johnbender Jun 6, 2012
@johnbender
Copy link
Contributor

@hansjorg

I think we should probably add $.mobile.path helper that converts hashes to id's by truncating after an invalid character, since cleanHash just strips the query separator and everything after it even though ? is a valid id character (http://www.w3.org/TR/html4/types.html#type-name).

This unfortunately also highlights the bigger issue which is that we don't currently support query params to embedded pages. Your example actually appears to work by accident:

$( "#second-page?foo=bar" );

throws an exception, but

$( "body").children( "#second-page?foo=bar" );

returns the page you were expecting for some reason that I haven't take the time to investigate in Core. The reason that $( "body").children( "#second-page?foo=bar.bak" ); doesn't work is because children interprets the dot value as a class selector.

I've commented on your pull request as well.

@johnbender
Copy link
Contributor

#4495

For reference.

@DzenisevichK
Copy link

I have been got similar problem:

These links are work:
http://jquerymobile.com/test/docs/pages/multipage-template.html#two?param=space%20-
http://jquerymobile.com/test/docs/pages/multipage-template.html#two?param=nospace-

but this one doesn't:
http://jquerymobile.com/test/docs/pages/multipage-template.html#two?param=space+-

($.param() encoded space as +)

jqm.page.params.js plugin doesn't handle this case too...

@johnbender
Copy link
Contributor

@DzenisevichK

We don't currently support query params to embedded pages. You can look into the plugin here if you like:

https://github.com/azicchetti/jquerymobile-router

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants