Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

base tag resets after manually setting it (phonegap) #4916

Closed
@knightcode

Description

@knightcode

I've got a jqm app running in phonegap. The main index.html, js, and css files are all stored locally. The index page consists of one jqm page (data-role=page), another div whose data-role is set to 'page' for rendering but is displayed as a stacked panel with a list of links, and several jqm dialog pages. When the app first starts up, the base of the document is set to a local file, e.g. file:///my/path/to/a/index.html, which is appropriate for loading all the local js and css files that are referenced from index.html with relative paths.

When the document is loaded, though, the base is set to the server to start loading new jqm pages with actual content. This works fine both using $.mobile.base.set() or manually finding and setting the href of the base tag.

This is when the stacked panel is shown. Almost every page from the server has a button to show the stack panel, and it is populated with a list of links to other jqm pages, all with relative paths to the server in their href's. As such, it's easiest if each jqm page has an href like, href="#stackedpanel" and a handler then catches the 'pagebeforechange' event, calls preventDefault(), and shows the stacked panel. So far so good.

When any of the links in the stacked panel are clicked, however, and not until they're clicked, the base tag reverts to the original file://my/path/to/a/index.html before the ajax call is made, which then fails. So, for instance, with a server, http://mysite.com/, and a relative path in the stacked panel of /foo/bar/, it tries to then load file:///foo/bar.

I can understand that this stack panel is originally in the local file context, but by manually setting the base, I've specified otherwise. Shouldn't it respect that?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions