-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Kynikos
-
-
I've already modified https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base and the edit hasn't been reverted, so I guess it's ok. What can we do to have the w3schools.com example fixed too?
-
According to http://www.w3.org/TR/html5/document-metadata.html#the-base-element shouldn't the example in http://www.w3schools.com/tags/tag_base.asp have a base tag that points to the current page (not just the directory)? That would solve some problems with link fragments and query strings as outlined in e.g. http://stackoverflow.com/questions/1889076/is-it-recommended-to-use-the-base-html-tag
EDIT: This is a possible way I'd modify the example:
<head><base href="http://www.w3schools.com/page.html'>http://www.w3schools.com/page.html" target="_blank"></head><body><img src="images/stickman.gif" width="24" height="39" alt="Stickman"><a href="http://www.w3schools.com">W3Schools</a></body>
HTML base tag example
in Suggestions
Posted · Edited by Kynikos
You make a point about the redundancy in that particular use case, but:
1) w3.org's specifications for HTML 5 http://www.w3.org/TR/html5/document-metadata#the-base-element and HTML 4.01 http://www.w3.org/TR/html401/struct/links.html#h-12.4 use full URLs in the examples, so currently I see an inconsistency. https://html.spec.whatwg.org/multipage/semantics.html#the-base-element uses full URLs too.
2) Suggesting to use a full URL (not necessarily to the current page) prevents the bugs reported in the stackoverflow discussion I linked in the OP; suggesting to use a directory URL has no advantage OTOH.
3) Having a base tag pointing to the current URL can be useful if a single document is saved locally, since all its relative links will still correctly point to the original domain. Also, always using a base tag could be a way to ensure crawling bots use the right URL for relative links.