7

Is it valid XHTML / good practice to have links of the following form? //www.example.com/foo/bar.html

If the current page is HTTP, then the link points to: http://www.example.com/foo/bar.html If the current page is secured under HTTPS, then the link points to: https://www.example.com/foo/bar.html

In other words, is

<a href="//www.example.com/">

valid in XHTML 1.1 Strict? And, is it supported by many/all browsers?

Taz
  • 3,718
  • 2
  • 37
  • 59
BMiner
  • 16,669
  • 12
  • 53
  • 53

1 Answers1

8

Is it valid XHTML

Completely. XHTML doesn't care about the syntax of URIs. The href attribute is defined as containing CDATA.

valid in XHTML 1.1 Strict?

There is no such language.

XHTML 1.0 has Strict / Transitional / Frameset versions.

XHTML 1.1 is just XHTML 1.1. (And isn't blessed by rfc2854 for serving as text/html (which you need for IE < 9 support)).

And, is it supported by many/all browsers?

Yes. Support is fine.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • I figured as much. Thanks for your response. Just trying to not upset the W3C police. :P All my pages must be valid XHTML, ya know. – BMiner Apr 20 '11 at 19:58