SlideShare a Scribd company logo
HTML5 <script> Tag

    Michelle Fowler
     MW Art2830
     Web Design
Supported by All Major Browsers
Definition of <script> Tag


● Is used to define a client-side script, such as a JavaScript

● Element either contains scripting statements or it points to
  an external script file through the "src" attribute
<script>

Example:




           http://homepage.cs.uri.edu/book/javascript/javascript.htm
Attributes




http://w3schools.com/html5/tag_script.asp
async Attribute

Example:

 ● <script type="text/javascript" src="demo_async.js" async="
   async"></script>
 ● <script async="async">

The async attribute is a boolean attribute, and can be set in the
following ways:
  ● <script async>
  ● <script async="async">
  ● <script async="">

Not supported by Internet Explorer
defer Attribute

Example:

 ● <script type="text/javascript" src="demo_defer.js" defer="
   defer"></script>
 ● <script defer="defer">

The defer attribute is a boolean attribute, and can be set in the
following ways:
  ● <script defer>
  ● <script defer="defer">
  ● <script defer="">
src Attribute

Example:

 ● <script type="text/javascript" src="demo_time.js"></script>
 ● <script src="URL">

Possible values:
 ● An absolute URL - points to another web site
  (like src="http://www.example.com/example.js")
 ● A relative URL - points to a file within a web site
  (like src="/scripts/example.js")
Differences Between
             HTML 4.01 & HTML5

● The "type" attribute is required in HTML 4, but optional in
  HTML5

● The "async" attribute is new in HTML5

● Some HTML 4.01 attributes are not supported in HTML5
Tips and Notes

● If the "src" attribute is present, the <script> element must be
  empty

● There are several ways an external script can be executed:
   ○ If async = "async": the script will be executed while the
     page continues the parsing
   ○ If async is not present and defer = "defer": the script is
     executed when the page has finished parsing
   ○ If neither async or defer is present: the script is fetched
     and executed immediately, before the browser continues
     parsing the page

More Related Content

PPTX
PPT
JAVA SCRIPT
PPTX
Angular js
PDF
Spa with angular
PDF
The Art of AngularJS - DeRailed 2014
PPTX
Javascript and DOM
PDF
SPA, Scalable Application & AngularJS
PPTX
Introduction to Django
JAVA SCRIPT
Angular js
Spa with angular
The Art of AngularJS - DeRailed 2014
Javascript and DOM
SPA, Scalable Application & AngularJS
Introduction to Django

What's hot (20)

PDF
Webdriver io presentation
PDF
Resftul API Web Development with Django Rest Framework & Celery
PDF
Introduction to SPA with AngularJS
PDF
App Engine
PPTX
A guide to getting started with WebdriverIO
PDF
PHP MVC Tutorial
PPTX
WebdriverIO: the Swiss Army Knife of testing
ODP
A Good PHP Framework For Beginners Like Me!
PPTX
Angular js
PPTX
Java script an introduction
PPTX
Single Page WebApp Architecture
PDF
[Srijan Wednesday Webinars] Choosing the Right Testing Framework
PDF
A Dynamic Analysis Framework for Front-end JavaScript
PDF
Principles of MVC for PHP Developers
PDF
Angular SEO
ODP
WordPress as a Platform - talk to Bristol Open Source Meetup, 2014-12-08
PDF
Javascript testing should be awesome
PPTX
JavaScript Framework Smackdown
PDF
React vs angular (mobile first battle)
PDF
Angular 2 overview
Webdriver io presentation
Resftul API Web Development with Django Rest Framework & Celery
Introduction to SPA with AngularJS
App Engine
A guide to getting started with WebdriverIO
PHP MVC Tutorial
WebdriverIO: the Swiss Army Knife of testing
A Good PHP Framework For Beginners Like Me!
Angular js
Java script an introduction
Single Page WebApp Architecture
[Srijan Wednesday Webinars] Choosing the Right Testing Framework
A Dynamic Analysis Framework for Front-end JavaScript
Principles of MVC for PHP Developers
Angular SEO
WordPress as a Platform - talk to Bristol Open Source Meetup, 2014-12-08
Javascript testing should be awesome
JavaScript Framework Smackdown
React vs angular (mobile first battle)
Angular 2 overview
Ad

Viewers also liked (7)

PPS
Лунтик
PPTX
игра жирафы-
PPT
Redesigning a website
PPT
весёлое путешествие
PPT
Презентация стили семейного воспитания
PDF
3Q 2016 Unconsolidated Earnings Presentation
PDF
3Q 2016 Consolidated Earnings Presentation 2016
Лунтик
игра жирафы-
Redesigning a website
весёлое путешествие
Презентация стили семейного воспитания
3Q 2016 Unconsolidated Earnings Presentation
3Q 2016 Consolidated Earnings Presentation 2016
Ad

Similar to 10x10 HTML5 Script Tag (20)

PDF
JS BASICS JAVA SCRIPT SCRIPTING
PDF
JavaScript - Chapter 3 - Introduction
PPT
Overview of PHP and MYSQL
PPTX
Lec4-WebClientSideExploitation.pptxdslkjhgfkjdshgfkjfhdkjg
DOC
Java script by Act Academy
PPTX
Best Option to learn start here HTML.pptx
PPTX
CHAPTER 3 JS (1).pptx
PDF
Developing High Performance Web Apps
PDF
Ride on the Fast Track of Web with Ruby on Rails- Part 2
PDF
java-scriptcdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc ...
PPT
Session vii(java scriptbasics)
PPTX
Client and server side scripting
PDF
Angular 2 vs React
DOCX
Angular js
PDF
AEM Sightly Deep Dive
PDF
More Than You Ever Wanted to Know About Resource Hints - Harry Roberts (CSS W...
PPTX
Java script Basic
PDF
Behave manners for ui testing pycon2019
PPTX
JavaScript - Getting Started.pptx
PDF
Unit 4(it workshop)
JS BASICS JAVA SCRIPT SCRIPTING
JavaScript - Chapter 3 - Introduction
Overview of PHP and MYSQL
Lec4-WebClientSideExploitation.pptxdslkjhgfkjdshgfkjfhdkjg
Java script by Act Academy
Best Option to learn start here HTML.pptx
CHAPTER 3 JS (1).pptx
Developing High Performance Web Apps
Ride on the Fast Track of Web with Ruby on Rails- Part 2
java-scriptcdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc ...
Session vii(java scriptbasics)
Client and server side scripting
Angular 2 vs React
Angular js
AEM Sightly Deep Dive
More Than You Ever Wanted to Know About Resource Hints - Harry Roberts (CSS W...
Java script Basic
Behave manners for ui testing pycon2019
JavaScript - Getting Started.pptx
Unit 4(it workshop)

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Chapter 2 Digital Image Fundamentals.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
KodekX | Application Modernization Development
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Modernizing your data center with Dell and AMD
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Empathic Computing: Creating Shared Understanding
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PDF
Transforming Manufacturing operations through Intelligent Integrations
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Spectral efficient network and resource selection model in 5G networks
PPT
Teaching material agriculture food technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
The Rise and Fall of 3GPP – Time for a Sabbatical?
Chapter 2 Digital Image Fundamentals.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KodekX | Application Modernization Development
NewMind AI Monthly Chronicles - July 2025
Modernizing your data center with Dell and AMD
madgavkar20181017ppt McKinsey Presentation.pdf
Chapter 3 Spatial Domain Image Processing.pdf
MYSQL Presentation for SQL database connectivity
Empathic Computing: Creating Shared Understanding
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Transforming Manufacturing operations through Intelligent Integrations
Per capita expenditure prediction using model stacking based on satellite ima...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Spectral efficient network and resource selection model in 5G networks
Teaching material agriculture food technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift

10x10 HTML5 Script Tag

  • 1. HTML5 <script> Tag Michelle Fowler MW Art2830 Web Design
  • 2. Supported by All Major Browsers
  • 3. Definition of <script> Tag ● Is used to define a client-side script, such as a JavaScript ● Element either contains scripting statements or it points to an external script file through the "src" attribute
  • 4. <script> Example: http://homepage.cs.uri.edu/book/javascript/javascript.htm
  • 6. async Attribute Example: ● <script type="text/javascript" src="demo_async.js" async=" async"></script> ● <script async="async"> The async attribute is a boolean attribute, and can be set in the following ways: ● <script async> ● <script async="async"> ● <script async=""> Not supported by Internet Explorer
  • 7. defer Attribute Example: ● <script type="text/javascript" src="demo_defer.js" defer=" defer"></script> ● <script defer="defer"> The defer attribute is a boolean attribute, and can be set in the following ways: ● <script defer> ● <script defer="defer"> ● <script defer="">
  • 8. src Attribute Example: ● <script type="text/javascript" src="demo_time.js"></script> ● <script src="URL"> Possible values: ● An absolute URL - points to another web site (like src="http://www.example.com/example.js") ● A relative URL - points to a file within a web site (like src="/scripts/example.js")
  • 9. Differences Between HTML 4.01 & HTML5 ● The "type" attribute is required in HTML 4, but optional in HTML5 ● The "async" attribute is new in HTML5 ● Some HTML 4.01 attributes are not supported in HTML5
  • 10. Tips and Notes ● If the "src" attribute is present, the <script> element must be empty ● There are several ways an external script can be executed: ○ If async = "async": the script will be executed while the page continues the parsing ○ If async is not present and defer = "defer": the script is executed when the page has finished parsing ○ If neither async or defer is present: the script is fetched and executed immediately, before the browser continues parsing the page