Skip to content Skip to sidebar Skip to footer

What's The De Facto Practice On Ampersand Encoding In Html?

By the HTML specification, an ampersand should be encoded as & But of course a lot on the web doesn't do that. Here's an example of an ad widget from Amazon.com:

Solution 1:

It should always be encoded - either as & or as &

However, a browser's parser is very forgiving :-)

Solution 2:

My personal experience:

The most common usage is using no practice at all; just put it in the code and see if it works in the browser that they happen to have installed.

More seasoned developers will at least check it in several dfferent browsers.

Those who care enough about robustness will validate the code and encode the characters correctly (which means encoding characters inside URLs also).

Post a Comment for "What's The De Facto Practice On Ampersand Encoding In Html?"