Script Tag in HTML5

In this article I am going to describe about the implementation and use of Script Tag in HTML5.
  • 1868

Script Tag

The <script> tag is most important for dynamic page. It is use for adding capability of scripting language in HTML document.  We also use <noscript> tag for providing content to browsers that don't support your scripting language.

The <script> tag is used to define a client-side script, such as a JavaScript. The <script> element either contains scripting statements, or it points to an external script file through the src attribute.Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content.

The HTML script element is used to embed or reference an executable script within an HTML or XHTML document. Scripts without async or defer attributes are fetched and executed immediately, before the browser continues to parse the page.

Browser Support

<script> tag is supported in all major browsers.


Syntax of <script> Tag in HTML5

<script type="">Scripting code</script>


    Attributes      Value     Description
      async      async Specifies that the script is executed asynchronously
     charset     charset Specifies the character encoding used in an external script file
      defer      defer Specifies that the script is executed when the page has finished parsing(loaded)
        src       src Specifies the URL of the external script file
       type     mime-type Specifies the type of script.


<!DOCTYPE html>


<html lang="en" xmlns="">


    <meta charset="utf-8" />

    <title>Script Tag</title>



    <h1>Implementation of &lt;script&gt; tag in HTML5.</h1>


        document.write("This tag is used to define a client-side script, such as a JavaScript.")






© 2020 DotNetHeaven. All rights reserved.