HTML Guides for empty host
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
When you set href="http://", the browser and the W3C validator attempt to parse this as an absolute URL. According to the URL Standard, a URL with the http or https scheme must include a non-empty host component. The string http:// has the scheme but nothing after the ://, which makes the host empty and the URL invalid.
This issue typically arises when a URL is dynamically generated but the variable or value for the domain is missing, or when a developer uses http:// as a temporary placeholder during development and forgets to replace it.
Why this matters
- Broken navigation: Clicking a link with href="http://" leads to unpredictable behavior. Some browsers may navigate to an error page, while others may interpret it differently.
- Accessibility: Screen readers announce links to users, including their destinations. An invalid URL creates a confusing experience for assistive technology users who expect the link to go somewhere meaningful.
- Standards compliance: The HTML specification requires that href values be valid URLs. An empty host violates the URL parsing rules, causing the W3C validator to flag it as an error.
- SEO: Search engine crawlers may treat invalid URLs as errors, potentially affecting how your site is indexed.
Examples
❌ Invalid: empty host in URL
<a href="http://">Visit our website</a>
This triggers the error because http:// has no host component.
❌ Invalid: same issue with HTTPS
<a href="https://">Secure link</a>
The https scheme also requires a valid host, so this produces the same error.
✅ Fixed: provide a complete URL
<a href="https://example.com">Visit our website</a>
✅ Fixed: use a fragment placeholder if the URL is unknown
If you need a placeholder link during development, use # instead of an incomplete URL:
<a href="#">Visit our website</a>
✅ Fixed: use a relative URL when linking within the same site
<a href="/about">About us</a>
Handling dynamic URLs
If the href value comes from a template or CMS, make sure the variable outputs a complete URL. For example, if a template produces an empty string, you might end up with:
<!-- If {{ site_url }} is empty, this becomes href="http://" -->
<a href="http://{{ site_url }}">Home</a>
Ensure that the variable always resolves to a valid host, or add a fallback so the link is omitted or replaced with a safe default when the value is missing.
An href attribute with the value http:// is not a valid URL because the host section is missing.
The href attribute in the area element must contain a valid URL. A URL requires a scheme (http or https), followed by ://, and then a valid host (such as example.com). The value http:// lacks a host, making it invalid according to URL standards and resulting in a validation error. If you don’t want the area to navigate anywhere, you can use href="#" for a placeholder or omit the href attribute entirely. To link to an actual location, provide the complete URL, including the host.
Invalid example:
<map name="myMap">
<area shape="rect" coords="30,23,183,191" href="http://" alt="" >
</map>
Valid example with a real host:
<map name="myMap">
<area shape="rect" coords="30,23,183,191" href="http://example.com/" alt="" >
</map>
Valid example with a placeholder, no navigation:
<map name="myMap">
<area shape="rect" coords="30,23,183,191" href="#" alt="" >
</map>
Replace http:// with a full URL or a suitable placeholder as needed for your application.
Ready to validate your sites?
Start your free trial today.