How to remove base tags from jQuery mobile scripts?
In jQuery Mobile:
- How to remove
<base href="">tags from a page - How to disable base href?
Relevant Code:
// Test for dynamic-updating base tag support ( allows us to avoid href,src attr rewriting ) function baseTagTest() { var fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/", base = $("head base"), fauxEle = null, href = "", link, rebase; if (!base.length) { base = fauxEle = $("<base>", { "href": fauxBase }).appendTo("head"); } else { href = base.attr("href"); } link = $("<a href='testurl' />").prependTo(fakeBody); rebase = link[0].href; base[0].href = href || location.pathname; if (fauxEle) { fauxEle.remove(); } return rebase.indexOf(fauxBase) === 0; } The base element is a key component of the jQuery mobile navigation model, so when jQuery mobile sites load in browsers that cannot dynamically update the base element, it adds the base URL.
Two suggestions to meet your needs:
Use absolute file paths instead of relative
Use jQuery Mobile Download Builder and configure the modules necessary for your jQuery Mobile application. My initial guess is that you want to exclude the navigation module in order to remove the functionality of the underlying element.