Forum Moderators: open

Message Too Old, No Replies

w3c validation and js type attribute?

type attribute

         

Lilylu

5:02 pm on Nov 30, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hi,

I wonder if anyone can help - I hope I am writing this in the correct section. I have been advised to validate my code and have fixed my errors apart from my javascript at the bottom of my website which is for my navigation. I receive this -

Warning: The type attribute is unnecessary for JavaScript resources.
<script src="https://******/ddmenu.js" type="text/javascript"></script>

I have tried to research what it could be changed to and although I have read about some possibilities, I'm not a coder and obviously don't want to do anything to jeopardise my site.

Does anyone here have any suggestions? :)

Thank you!

Fotiman

5:09 pm on Nov 30, 2017 (gmt 0)

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



Yes, just remove the type attribute.
<script src="https://******/ddmenu.js"></script>

Lilylu

5:12 pm on Nov 30, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



Wow! really! it's that simple? That's amazing! thank you so much, I really really appreciate your help! :D

Fotiman

5:21 pm on Nov 30, 2017 (gmt 0)

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



No problem. :)

Lorel

7:34 pm on Dec 2, 2017 (gmt 0)

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



I was surprised by this also. I wish they would post a notice on W3c when these change.

keyplyr

7:55 pm on Dec 2, 2017 (gmt 0)

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



Depends on your doctype.

Up until html5 type was needed for the browser to distinguish between js and other text. With html5 it is no longer needed.

There are always updates with each new html version. That's the point.

lucy24

11:15 pm on Dec 2, 2017 (gmt 0)

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



Also note that it's flagged as a “warning”, not as an “error”. That means nothing bad will happen even if you leave it unchanged; it's more of an FYI.

I think the validator still demands a “type” for CSS, even though nobody ever got around to developing alternative style formats.

keyplyr

11:21 pm on Dec 2, 2017 (gmt 0)

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



One thing that I value as important is keeping valid code so the browser stays in Standards Compliant mode.

If there are errors in the page code, the browser *may* go into Quirks mode... meaning that it will guess. IMO this is not what you want.

Keeping the code without error in ensure the the browser stays in Stands Compliant mode and will render the page markup closer to your intention.

keyplyr

6:30 am on Dec 3, 2017 (gmt 0)

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



Sorry... last paragraph should read:

Keeping the code without error ensures the browser stays in Standards Compliant mode and will render the page markup closer to your intention.

Stupid spell checker :)

lucy24

6:49 pm on Dec 3, 2017 (gmt 0)

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



“Stands Compliant”, coming soon to a theater near you.

I thought it was the DTD that determined whether the browser goes into Quirks Mode or not.

Lilylu

6:58 pm on Dec 3, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



&#128513;

I sure hope that when people visit my site it stays in Standard Compliant mode. Fingers crossed having validated pages now, will make sure people see it as it should be. It has been very interesting reading everyone’s replies.