Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

No support for linking to document fragments (anchor links) #3616

Open
scottjehl opened this Issue · 3 comments

4 participants

@scottjehl

In non-pushstate browsers, jQM manages its history and deep linking behavior through the hash. When the page loads, or when the hash changes, it’s designed to interpret anything in the hash as a reference to an actual document, either local or remote. It’s a great way to make sure the back button and linking works in most any browser, but it’s also a great way of killing a behavior that’s really useful developers and users.

I think it’s important that we build on top of the native way of doing things, rather than introducing a whole new weird way of linking.

If we look to enhance on top of the native syntax, that means links to URLs like “about.html#foo” would have to request about.html via Ajax, then set that page’s end scroll distance to the top offset of an element with an ID of #foo (if it exists in the page). Clicking back to that page would have to have some business rules about whether the URL or a remembered scroll would take precedence. On page load, jQM will have to first check if an element with an ID of “foo” exists in the page, and if it’s not a page element, it should simply scroll to that element’s position. All this will require a change in maybe a few places in the nav handler.

I’m not sure we’ll be able to make this mechanism work for non-pushstate browsers at all, because when we update the hash, we’ll already need to use it for the URL, and we can’t have 2 of hashes. But, we can probably make navigating TO the fragment work in non-pushstate browsers, with the downside that the fragment may not remain in the URL for bookmarking (so you'd lose the scroll distance if you tried.)

For 1.2, it'd be nice to see if we can finally work this out.

@scottjehl scottjehl was assigned
@toddparker

Moving to 1.3

@toddparker

This is an incredibly important feature but is going to need to be built on top of deep AJAX nav re-work so we're going to move this to 1.4.

@dalethedeveloper

I sidestepped this with the following code, just in case anyone comes looking for a short term solution.

https://gist.github.com/dalethedeveloper/6511417

@scottjehl scottjehl was assigned
@arschmitz arschmitz was assigned
@arschmitz arschmitz modified the milestone: 1.6.0, 1.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.