External links with hashes aren't clickable #5759

Closed
nightbook opened this Issue Mar 12, 2013 · 2 comments

Projects

None yet

3 participants

@nightbook

Hello,
Found a minor issue with any external link that has a hash on it.
From - http://view.jquerymobile.com/1.3.0/docs/widgets/links/
'Links that point to other domains or that have rel="external", data-ajax="false" or target attributes will not be loaded with AJAX.'
This holds true for all but urls of other domains with hash, for example;
http://www.google.com#hash if used as the href in an internal link is unclickable.
See jsfiddle - http://jsfiddle.net/nXkzd/1/
I've tried with several cases all lead to those with hash.

Adding a rel="external" does fix the issue, but sadly the content is dynamically generated, also tried the data-ajax="false" on the container with no luck. Will revert to jQuery to add the rel="external" attribute to links with hash.

Appreciate you looking into it, let me know if any further info is of help
Cheers

@cgack
Contributor
cgack commented Apr 24, 2014

The issue here is that the $.mobile.path.isExternal( href ) at https://github.com/jquery/jquery-mobile/blob/master/js/navigation.js#L389 is using an href that has already had the fragment removed from the url . I'd like to assume that moving this whole section of isExternal logic before the handling of the # at https://github.com/jquery/jquery-mobile/blob/master/js/navigation.js#L360
would work and still make sense to handle external links.

@gabrielschulhof gabrielschulhof self-assigned this Aug 20, 2014
@gabrielschulhof gabrielschulhof added this to the 1.4.4 milestone Aug 20, 2014
@nightbook

Thanks @gabrielschulhof and @cgack for the follow-up

@gabrielschulhof gabrielschulhof added a commit that referenced this issue Aug 21, 2014
@gabrielschulhof gabrielschulhof Navigation: Click handler correctly handles absolute URL with hash
(cherry picked from commit bdfe15d)

Closes gh-7632
Fixes gh-5759
4813c33
@agcolom agcolom added a commit to agcolom/jquery-mobile that referenced this issue Nov 26, 2014
@gabrielschulhof @agcolom gabrielschulhof + agcolom Navigation: Click handler correctly handles absolute URL with hash
Closes gh-7632
Fixes gh-5759
61a3899
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment