Closed Bug 404876 Opened 18 years ago Closed 16 years ago

Support "protocol-relative"/"scheme-relative" URI in BASE HREF, like "//example.com/"

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 249881

People

(Reporter: mozilla-bugs, Unassigned)

Details

User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.8 (like Gecko) Build Identifier: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.1.8) Gecko/20071022 Ubuntu/7.10 (gutsy) Firefox/2.0.0.8 Given '<base href="//example.com/" />', a relative URL "foo" should link to http://example.com/foo when using http and to https://example.com/foo when using https. Konqueror, IE(6), Opera and Safari all handle it like expected. Firefox (including 3.0-alpha) is the only one, which ignores it. For example: <html> <head> <base href="//example.com/" /> </head> <body> <img src="foo" /> <a href="foo">foo</a> </body> </html> Reproducible: Always Actual Results: The BASE HREF gets ignored, if it's "protocol-relative" or "relative to the current scheme". Expected Results: The image src should get expanded to http://example.com/foo and the link should point to http://example.com/foo. RFC3986 says: 5.1. Establishing a Base URI The term "relative" implies that a "base URI" exists against which the relative reference is applied. Aside from fragment-only references (Section 4.4), relative references are only usable when a base URI is known. A base URI must be established by the parser prior to parsing URI references that might be relative. A base URI must conform to the <absolute-URI> syntax rule (Section 4.3). If the base URI is obtained from a URI reference, then that reference must be converted to absolute form and stripped of any fragment component prior to its use as a base URI.
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Here is similar bug #56280 which has been closed because HTML explicitly forbids relative URL base/@href. However today we have XHTML and I think XHTML allows relative base URLs.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.