: Can I omit the domain name for href in the HTML base tag? Currently on my website, I use an HTML base tag to shorten URLs in anchor tags. All URLs on my site belong to one domain. For
Currently on my website, I use an HTML base tag to shorten URLs in anchor tags. All URLs on my site belong to one domain. For 100% compliance, I use an absolute URL. for example:
<base href="http://www.example.com/path/to/specialpage/">
I looked on the internet to see if I can somehow shorten this and have it still work in browsers invented within the last 10 years. I wanted to do something like:
<base href="/path/to/specialpage/">
My question is, if I used the above code, would major browsers like Internet Explorer break down? or are there bugs in major browsers with shortening of this tag? I want to try to omit the domain name yet make my site still work with every browser made in the last 10 years, even if it means including a special tag for a specific browser, maybe I need something like:
<!-- firefoxpatchID=1 -->
<base href="/path/to/specialpage/">
<!-- endfirefoxpatch -->
Whats the solution here? could I just get away with omitting the domain and every browser would be happy or do I have to do something special to certain browsers in order to accommodate my idea?
More posts by @LarsenBagley505
1 Comments
Sorted by latest first Latest Oldest Best
No. The href must point to an absolute URI. Relative is not allowed on a base element.
This attribute specifies an absolute URI that acts as the base URI for
resolving relative URIs.
The HTML5 standard says, in reference to the href attribute of <base>:
The document base URL of a Document object is the absolute URL
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.