Do we need implement defer = “defer” to all scripts except internal scripts
up vote
3
down vote
favorite
I am reading the "Professional Javascript for web developers" and I find it says
The purpose of
defer
is to indicate that a script won't be changing the structure of the page as it executes. As such, the script can be run safely after the entire page has been parsed.
Hence, the defer
is good for our program, I want to know if we need to put the defer in all scripts except internal scripts?
javascript html
add a comment |
up vote
3
down vote
favorite
I am reading the "Professional Javascript for web developers" and I find it says
The purpose of
defer
is to indicate that a script won't be changing the structure of the page as it executes. As such, the script can be run safely after the entire page has been parsed.
Hence, the defer
is good for our program, I want to know if we need to put the defer in all scripts except internal scripts?
javascript html
1
You can only defer external scripts, you can't defer internal scripts. You only put defer on scripts you want to execute after the page has rendered. this allows you to remove theDOMContentLoaded
event in those scripts (there is more to it than just that though). So putting it on all scripts is a case-by-case basis.
– Get Off My Lawn
Nov 16 at 20:38
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I am reading the "Professional Javascript for web developers" and I find it says
The purpose of
defer
is to indicate that a script won't be changing the structure of the page as it executes. As such, the script can be run safely after the entire page has been parsed.
Hence, the defer
is good for our program, I want to know if we need to put the defer in all scripts except internal scripts?
javascript html
I am reading the "Professional Javascript for web developers" and I find it says
The purpose of
defer
is to indicate that a script won't be changing the structure of the page as it executes. As such, the script can be run safely after the entire page has been parsed.
Hence, the defer
is good for our program, I want to know if we need to put the defer in all scripts except internal scripts?
javascript html
javascript html
edited Nov 16 at 21:05
Barmar
412k34237339
412k34237339
asked Nov 16 at 20:32
Cvanzy
163
163
1
You can only defer external scripts, you can't defer internal scripts. You only put defer on scripts you want to execute after the page has rendered. this allows you to remove theDOMContentLoaded
event in those scripts (there is more to it than just that though). So putting it on all scripts is a case-by-case basis.
– Get Off My Lawn
Nov 16 at 20:38
add a comment |
1
You can only defer external scripts, you can't defer internal scripts. You only put defer on scripts you want to execute after the page has rendered. this allows you to remove theDOMContentLoaded
event in those scripts (there is more to it than just that though). So putting it on all scripts is a case-by-case basis.
– Get Off My Lawn
Nov 16 at 20:38
1
1
You can only defer external scripts, you can't defer internal scripts. You only put defer on scripts you want to execute after the page has rendered. this allows you to remove the
DOMContentLoaded
event in those scripts (there is more to it than just that though). So putting it on all scripts is a case-by-case basis.– Get Off My Lawn
Nov 16 at 20:38
You can only defer external scripts, you can't defer internal scripts. You only put defer on scripts you want to execute after the page has rendered. this allows you to remove the
DOMContentLoaded
event in those scripts (there is more to it than just that though). So putting it on all scripts is a case-by-case basis.– Get Off My Lawn
Nov 16 at 20:38
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53344990%2fdo-we-need-implement-defer-defer-to-all-scripts-except-internal-scripts%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You can only defer external scripts, you can't defer internal scripts. You only put defer on scripts you want to execute after the page has rendered. this allows you to remove the
DOMContentLoaded
event in those scripts (there is more to it than just that though). So putting it on all scripts is a case-by-case basis.– Get Off My Lawn
Nov 16 at 20:38