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

BASE tag doesn't seem to work for images in Firefox #263

Closed
scottjehl opened this issue Oct 20, 2010 · 3 comments
Closed

BASE tag doesn't seem to work for images in Firefox #263

scottjehl opened this issue Oct 20, 2010 · 3 comments

Comments

@scottjehl
Copy link

Thumbs show here: http://jquerymobile.com/test/docs/lists/lists-thumbnails.html
No thumbs show here: http://jquerymobile.com/test/#docs/lists/lists-thumbnails.html

In the second link, we inject a base tag to fix the path for assets that load on that page. We may need to inject it earlier in Firefox (before injecting the page), or maybe base elements can't be updated in Firefox, in which case we'll need to rewrite href and src attributes with proper base urls. Not good.

@scottjehl
Copy link
Author

Update: it looks like Firefox needs a full href for base to work. I'm still unsure whether it also needs that tag to be in the markup at load or whether it can be appended to head and dynamically updated as pages are loaded.

@scottjehl
Copy link
Author

Added a support test $.support.dynamicBaseTag and workaround for browsers that don't support dynamically updating BASE tag (Firefox is the only one I've seen so far. In those browsers, when a new page is fetched, any elements with href and src attributes will have their attribute prefixed with a proper base url (if they don't already start with an external site http address, "/", "#", or any protocol such as "mailto:, etc).

In the process, the BASE element and related functions are only implemented if that support is true, and BASE urls now use a full URL path when set, to avoid issues with browsers that may need that.

Closed by 70bba70, Closed by 70bba70

@pauln
Copy link
Contributor

pauln commented May 2, 2011

This problem doesn't seem to be entirely fixed. If an image's src is set to a full URL, but is not from an external site, it gets rewritten incorrectly (in Firefox 3.6) if it's from a higher-level folder. I've built a quick example based off the list test page (http://jquerymobile.com/test/docs/lists/lists-icons.html):
Broken (AJAX loaded): http://next.gen.nz/bugs/jqm-images/#/bugs/jqm-images/icons/index.html
Working (standard HTTP load): http://next.gen.nz/bugs/jqm-images/icons/index.html

This example uses the JQuery Mobile code directly from the http://jquerymobile.com/test/ so it should be able to be used as a final test if/when a fix makes it that far.

Note that this issue has arisen in a theme for a web application - i.e. it's not possible to work around this by changing the URLs, as that would require modifying the application itself.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants