jQuery Difference between internal and external script
Today, We want to share with you jQuery Difference between internal and external script.
In this post we will show you jQuery Difference between internal and external script, hear for jQuery Difference between internal and external script we will give you demo and example for implement.
In this post, we will learn about jQuery Difference between internal and external script with an example.
The rule is simple: According to me,All The js-script should be external file used. Both for maintenance mode and performance mode.
Internal scripting :
Are loaded in the same page means itself so is not necessary to trigger another page request.
Are executed or run mode immediately and fast.
The async data and defer data attributes have no effect
It Can be helpful when you are using a server-side script dynamic rendering.
Internal scripting(itself) means writing mode to some the script functions available in the same HTML tag/page or Same PAGE itself.
<html lang ="en">
<link rel="stylesheet" type="text/css" href="pakainfo/css/style.css">
<p onclick=alert("WELCOME to Angularjs My blog: pakainfo.com")>www.pakainfo.com</p>
In the above simple example, onclick function has been declared in the HTML p tag itself.
Gives better separation and best of concerns and useful of maintainability means structure.
The async data and defer data attributes have same effect so if this some attributes are present mode the js-script will change all the default behavior.and then This is not possible any with inline data js scripts.
Once a external script is downloaded and used any other the browser store it in the cache memory so if another page reference and used some web-apps it no additional download is required.
It Can be used to load time to client code on demand and some reduce overall data download time and size.
Your Web-Application Writing the script(any js) in external file scripting way is the more best practice method.
The simple way to External js-scripting is preferable and more easy than the internal js-scripting. pure reason we can use the some code effectively in show and (structure vise)execure external scripting than internal.