panthro
panthro

Reputation: 24061

www anchors do not open site

JSFiddle

I have a link in my site:

<a href="www.bff.org.uk">BFI</a>

This may appear on a page with the URL:

mysite.com/articles/60

Clicking the link will go to

mysite.com/articles/60/www.bff.org.uk

I know adding http to the anchor resolves this, but why does www not go to the site? Is there a way to fix it so that www links do go to the site?

Upvotes: 2

Views: 59

Answers (2)

James Donnelly
James Donnelly

Reputation: 128791

...but why does www not go to the site?

Why would "www" imply that the URL's scheme is http by default? What if you had a folder named www.bff.org.uk set up in your site? Also why couldn't "www" here have a scheme of https, ftp or file? What about tel, app or even skype or itunes?

Is there a way to fix it so that www links do go to the site?

Not without adding in the http:// part or introducing some peculiar JavaScript to detect and convert this for you.

Upvotes: 3

Cagri Tacyildiz
Cagri Tacyildiz

Reputation: 17590

You need to use http or https protocols

<a href="http://www.bff.org.uk/">BFI</a>

you should read here html - links without http protocol

Upvotes: 0

Related Questions