pre-existing base tag breaks relative links #5083

pillex opened this Issue Sep 25, 2012 · 1 comment


None yet
2 participants

pillex commented Sep 25, 2012

Issue description

jquery mobile is currently unusable for websites with a base tag in the header and relative links on the page. an existing base tag is not properly recognized when generating full links from relative links.

instead of base+relativeLink jQM loads currentURL+relative link

Steps to reproduce

(ZEND framework. url-rewrite is on)

base tag in header: base href=""

on a page with url

is a relative link href="show_car/id/35/"

if i hover over the link, google chrome shows correctly:

Expected outcome

clicking the link should load:

base + relative link

Actual outcome

clicking the link tries to load

currentURL+relative link
base tag is not recognized

jQuery Mobile and jQuery core version used

all versions of jQM 1.2.0

Devices/platforms/browsers tested

-google chrome on win 7
-native android browser on android 4.1
-safari on iOS 5.1.1

Other relevant information

to make it work, i have to change two lines in every new rc of 1.2.0


on line 1239 instead of
if ( !url || !path.isPath( url ) ) { url = base;}
url = base;

this fixes the not recognized existing base tag. now clicking links loads the correct pages.

but on the loaded page (into the dom), the image paths were invalid. to fix this i had to replace
on line 848

var newPath = path.get( fileUrl );
var newPath = path.get( $('head base').attr('href') );

johnbender was assigned Dec 21, 2012

johnbender closed this Apr 10, 2013


johnbender commented Apr 10, 2013


Based on your comments in #4456 I've closed this issue. $.mobile.dynamicBaseEnabled = false in a mobileinit binding will prevent JQM from altering your base tag.

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