Forum Moderators: open

Message Too Old, No Replies

Some html validators are flagging these html tags as error.

         

born2run

2:05 am on Aug 17, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi so I have the following html / metatags in my html file:

====
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5BBAD5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
====

Are these code valid? Please advise. Thanks!

Dimitri

7:44 am on Aug 17, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



Some html validators

Stick with the W3C Validator : [validator.w3.org...]

flagging these html tags as error.

Which kind of error? It looks good to me, (you don't need the " /> " on the first line) . However, it might depend of your DOCTYPE , but the above seems okay to me if , this is HTML 5.

born2run

1:13 pm on Aug 17, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ok thanks, the w3c validtor oks it. Additionally I have a script like this in the page:

<script type="text/javascript" charset="utf-8" src="https://www.abc.com/p/xyz.js"></script>

W3c validator is warning over the type & charset code (unneeded). Would keeping them as it is OK?

Dimitri

1:32 pm on Aug 17, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



W3c validator is warning over the type & charset code (unneeded). Would keeping them as it is OK?

Yes, you can keep the "type" and "charset", but as mentioned they are no longer needed in HTML5, however keeping them is okay.

edit: Indirectly related: stay consistent with your charset, don't start mixing different charset, this is going to be mess and hard to maintain. Stick with UTF8 for everything, including your database.

lucy24

4:56 pm on Aug 17, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In general, keeping something that w3c says isn't needed will not do any harm--but, like they say, it isn't needed. Sometimes you just have to use your judgement. Take the case of
style type = "text/css"
At one point the html validator and css validator weren't talking to each other, leading to (this is my actual email, sent in December 2017):
The HTML validator says:
Warning: The type attribute for the style element is not needed and should be omitted.

The CSS validator says:
Warning: You should add a 'type' attribute with a value of 'text/css' to the 'style’ element

Could the two of them at least try to get their stories straight?
Others besides me must have grumbled about the same thing, because it has since been fixed.

born2run

12:35 pm on Aug 20, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ok thanks guys. I'll leave the code as is.