Welcome to WebmasterWorld Guest from 54.226.113.250

Forum Moderators: open

w3c validation and js type attribute?

type attribute

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

New User

Top Contributors Of The Month

joined:Feb 15, 2016
posts: 8
votes: 0


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!
5:09 pm on Nov 30, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 17, 2005
posts: 5012
votes: 23


Yes, just remove the type attribute.
<script src="https://******/ddmenu.js"></script>
5:12 pm on Nov 30, 2017 (gmt 0)

New User

Top Contributors Of The Month

joined:Feb 15, 2016
posts: 8
votes: 0


Wow! really! it's that simple? That's amazing! thank you so much, I really really appreciate your help! :D
5:21 pm on Nov 30, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 17, 2005
posts: 5012
votes: 23


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

Senior Member from US 

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

joined:June 4, 2002
posts: 1840
votes: 3


I was surprised by this also. I wish they would post a notice on W3c when these change.
7:55 pm on Dec 2, 2017 (gmt 0)

Moderator from US 

WebmasterWorld Administrator keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:10216
votes: 570


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.
11:15 pm on Dec 2, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14321
votes: 562


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.
11:21 pm on Dec 2, 2017 (gmt 0)

Moderator from US 

WebmasterWorld Administrator keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:10216
votes: 570


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.
6:30 am on Dec 3, 2017 (gmt 0)

Moderator from US 

WebmasterWorld Administrator keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:10216
votes: 570


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 :)
6:49 pm on Dec 3, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14321
votes: 562


“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.
6:58 pm on Dec 3, 2017 (gmt 0)

New User

Top Contributors Of The Month

joined:Feb 15, 2016
posts: 8
votes: 0


&#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.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members