{"id":9337,"date":"2022-10-06T04:59:15","date_gmt":"2022-10-06T04:59:15","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=9337"},"modified":"2022-10-06T04:59:15","modified_gmt":"2022-10-06T04:59:15","slug":"html-async-attribute","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/10\/06\/html-async-attribute\/","title":{"rendered":"HTML async Attribute"},"content":{"rendered":"\n<p>The&nbsp;async&nbsp;attribute is a boolean attribute and specifies that the script will be executed asynchronously once it is available. It only works for external scripts and must be used only when the&nbsp;src&nbsp;attribute is present.<\/p>\n\n\n\n<p>You can use the\u00a0async\u00a0attribute on the\u00a0&lt;script>\u00a0element.<\/p>\n\n\n\n<p>An external script can be executed in the following ways:<\/p>\n\n\n\n<ul><li>When async is present, the script will be executed asynchronously while the page continues the parsing.<\/li><li>When async is not present but defer is present, the script will be executed when the page finishes the parsing.<\/li><li>When neither async or defer is present, the script will be executed immediately before the browser continues the parsing.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"syntax-2\">Syntax<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script src=\"example.js\" async&gt;&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-span-class-attribute-async-span-attribute-4\">Example of the HTML&nbsp;async&nbsp;attribute:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the documnet&lt;\/title&gt;\n    &lt;script src=\"example.js\" async&gt;&lt;\/script&gt;\n    &lt;noscript&gt;Sorry, your browser does not support JavaScript!&lt;\/noscript&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h1&gt;Example&lt;\/h1&gt;\n    &lt;p&gt;\n      A browser that doesn\u2019t support JavaScript will display the content inside the noscript element.\n    &lt;\/p&gt;\n    &lt;script&gt;\n      document.write(\"My first JavaScript example!\")\n    &lt;\/script&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The&nbsp;async&nbsp;attribute is a boolean attribute and specifies that the script will be executed asynchronously once it is available. It only works for external scripts and must be used only when the&nbsp;src&nbsp;attribute is present. You can use the\u00a0async\u00a0attribute on the\u00a0&lt;script>\u00a0element. An external script can be executed in the following ways: When async is present, the script [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[327],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/9337"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=9337"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/9337\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=9337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=9337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=9337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}