I need help with this: Attribute name "async" associated with an element type "script" must be followed by the ' = ' character

What should this code look like, how do I fix it so it works?


<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

It looks like it’s missing either HTTP or HTTPS from the front of the src URL.

This code is directly from twitter:

<a class="twitter-timeline" href="https://twitter.com/TwitterDev/lists/national-parks">A Twitter List by TwitterDev</a> 
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

This is for blogger, different set of rules for that.

Attribute name “async” associated with an element type “script” must be followed by the ’ = ’ character.

What should be changed in this part?

<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

http://www.w3schools.com/tags/att_script_async.asp

Use async="async" or async="" instead of just async.

1 Like

Thanks. Both async=“async” or async=“” works.

Protocol-relative URLs are used so that if the browser is viewing that current page via HTTPS, then it’ll request that asset with the HTTPS protocol, otherwise it’ll typically request it with HTTP.

Interestingly it’s considered an anti-pattern now (which I didn’t realise).
https://www.paulirish.com/2010/the-protocol-relative-url/

1 Like

Just out of curiosity, where was the error being reported? Within jsfiddle itself, or somewhere else? Console?

Because the async attribute is a boolean, might the empty string be considered as a false by some browsers?

1 Like

Not that I know of. According to the spec, “async” and “” are both ok. See https://www.w3.org/TR/html-markup/script.html and https://www.w3.org/TR/html5/infrastructure.html#boolean-attribute

1 Like

Google Blogger when inputting the code.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.