Let’s start with the MDN docs for the base element, they say: The HTML
<base> element specifies the base URL to use for all relative URLs contained within a document.
That sounds like it could be pretty useful. You could change the base to be the root, so there would be no more getting relative/absolute URLs mixed up.
<head> <base href="/"> </head> <a href="test">Relative URL</a> <a href="/test">Absolute URL</a> <a href="https://google.co.uk">External URL</a>
If the code above was run on
martinblackburn.co.uk/some-page, then each of the URL’s would go to the following places:
You can also specify a
target on the base element.
<head> <base href="/" target="_blank"> </head>
You can overwrite each URL to open where you want, so
<a href='/some-page' target='_self'>Some page</a> will make that link open in the same window.