Navigation - Query String sticks around #7239

Closed
PangbornIdentity opened this Issue Mar 11, 2014 · 4 comments

Projects

None yet

3 participants

@PangbornIdentity

Hey JQM,

I'm having an issue with a direct link's Query value. The value is persistant across pagemanger change page calls, I'm able to alter it, but not remove it. This is easy to reproduce,

  1. Click on the JSBin: http://jsbin.com/acIRUBo/13?AR=123#page2 (this will take you directly to page2, with a query).
  2. Click goto page 3,
  3. Notice in the url the Query is still hanging around, even though not supplied to the change page event.

I was able to track down multiple places where the absolute url is compared as the current url (including the query). I found the best place to fix this issue is within the Squash function, by removing the old url query.

Suggest a PULL request changing it from:

// produce a url against which we can resole the provided path
resolutionUrl = resolutionUrl || (path.isPath(url) ? path.getLocation() : path.getDocumentUrl());

to

resolutionUrl = resolutionUrl || (path.isPath(url) ? path.getLocation() : path.getDocumentUrl());
// remove resolution search, search should come from url
resolutionUrl = this.parseUrl(resolutionUrl).hrefNoSearch;

or

// produce a url against which we can resole the provided path
// remove resolution search, search should come from url
resolutionUrl = this.parseUrl( resolutionUrl || (path.isPath(url) ? path.getLocation() : path.getDocumentUrl())).hrefNoSearch;
@arschmitz
Member

the current behavior is correct only the hash should be updated this is the native behavior see http://jsbin.com/acIRUBo/14?abc=123#page2

@arschmitz arschmitz closed this Mar 11, 2014
@PangbornIdentity

@arschmitz
For a proper single page application, I really need to use the Query on a page by page basis, and not the entire web app. Is there another way to do this?
What about passing an option to pageContainer's change function?
Something like changeSearch: true / false ?

@gabrielschulhof
Collaborator

@PangbornIdentity We have a demo that illustrates passing information to an internal page via a "query string" (using quotes here because it's not a real query string) attached to the hash: http://demos.jquerymobile.com/1.4.2/navigation-hash-processing/

@PangbornIdentity

@gabrielschulhof Thanks will look into

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment