Browser executes JavaScript files before they load completely
I have observed a rather strange anomaly in a web application.
Tech stack:
Front-End: ReactJS
Back-End: .NET Core application + Kestrel
Behavior
The root HTML page of the application loads several key JS files required for creating the web app.
For some reason its possible that a given file of, say, 500 KB loads about halfway and is then executed.
An error can be seen in the console that an exception occurred on line so and so, indicating that the file has not loaded completely and is therefore corrupt.
Also, if this happens once for a user, on page refresh the browser will reuse the incomplete file from cache.
I know it would be extremely helpful if I could provide additional logs/network call headers etc but I do not have access to such at the moment.
I am guessing that the files are being served in some strange way as I would assume a browser should be aware of the total file size of the resource its requesting for, so it should be able to know when it does not load completely.
javascript .net-core kestrel-http-server
add a comment |
I have observed a rather strange anomaly in a web application.
Tech stack:
Front-End: ReactJS
Back-End: .NET Core application + Kestrel
Behavior
The root HTML page of the application loads several key JS files required for creating the web app.
For some reason its possible that a given file of, say, 500 KB loads about halfway and is then executed.
An error can be seen in the console that an exception occurred on line so and so, indicating that the file has not loaded completely and is therefore corrupt.
Also, if this happens once for a user, on page refresh the browser will reuse the incomplete file from cache.
I know it would be extremely helpful if I could provide additional logs/network call headers etc but I do not have access to such at the moment.
I am guessing that the files are being served in some strange way as I would assume a browser should be aware of the total file size of the resource its requesting for, so it should be able to know when it does not load completely.
javascript .net-core kestrel-http-server
Is the file there when you request it? Or is some on the fly minification involved. You could try adding a content-length header. (But it's just guessing in the dark)
– Roland Starke
Nov 24 '18 at 10:11
The file already exists. Its just being served by the kestler server.
– Gilbert Nwaiwu
Nov 24 '18 at 11:17
add a comment |
I have observed a rather strange anomaly in a web application.
Tech stack:
Front-End: ReactJS
Back-End: .NET Core application + Kestrel
Behavior
The root HTML page of the application loads several key JS files required for creating the web app.
For some reason its possible that a given file of, say, 500 KB loads about halfway and is then executed.
An error can be seen in the console that an exception occurred on line so and so, indicating that the file has not loaded completely and is therefore corrupt.
Also, if this happens once for a user, on page refresh the browser will reuse the incomplete file from cache.
I know it would be extremely helpful if I could provide additional logs/network call headers etc but I do not have access to such at the moment.
I am guessing that the files are being served in some strange way as I would assume a browser should be aware of the total file size of the resource its requesting for, so it should be able to know when it does not load completely.
javascript .net-core kestrel-http-server
I have observed a rather strange anomaly in a web application.
Tech stack:
Front-End: ReactJS
Back-End: .NET Core application + Kestrel
Behavior
The root HTML page of the application loads several key JS files required for creating the web app.
For some reason its possible that a given file of, say, 500 KB loads about halfway and is then executed.
An error can be seen in the console that an exception occurred on line so and so, indicating that the file has not loaded completely and is therefore corrupt.
Also, if this happens once for a user, on page refresh the browser will reuse the incomplete file from cache.
I know it would be extremely helpful if I could provide additional logs/network call headers etc but I do not have access to such at the moment.
I am guessing that the files are being served in some strange way as I would assume a browser should be aware of the total file size of the resource its requesting for, so it should be able to know when it does not load completely.
javascript .net-core kestrel-http-server
javascript .net-core kestrel-http-server
asked Nov 24 '18 at 9:49
Gilbert NwaiwuGilbert Nwaiwu
3501423
3501423
Is the file there when you request it? Or is some on the fly minification involved. You could try adding a content-length header. (But it's just guessing in the dark)
– Roland Starke
Nov 24 '18 at 10:11
The file already exists. Its just being served by the kestler server.
– Gilbert Nwaiwu
Nov 24 '18 at 11:17
add a comment |
Is the file there when you request it? Or is some on the fly minification involved. You could try adding a content-length header. (But it's just guessing in the dark)
– Roland Starke
Nov 24 '18 at 10:11
The file already exists. Its just being served by the kestler server.
– Gilbert Nwaiwu
Nov 24 '18 at 11:17
Is the file there when you request it? Or is some on the fly minification involved. You could try adding a content-length header. (But it's just guessing in the dark)
– Roland Starke
Nov 24 '18 at 10:11
Is the file there when you request it? Or is some on the fly minification involved. You could try adding a content-length header. (But it's just guessing in the dark)
– Roland Starke
Nov 24 '18 at 10:11
The file already exists. Its just being served by the kestler server.
– Gilbert Nwaiwu
Nov 24 '18 at 11:17
The file already exists. Its just being served by the kestler server.
– Gilbert Nwaiwu
Nov 24 '18 at 11:17
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f53456981%2fbrowser-executes-javascript-files-before-they-load-completely%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f53456981%2fbrowser-executes-javascript-files-before-they-load-completely%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
Is the file there when you request it? Or is some on the fly minification involved. You could try adding a content-length header. (But it's just guessing in the dark)
– Roland Starke
Nov 24 '18 at 10:11
The file already exists. Its just being served by the kestler server.
– Gilbert Nwaiwu
Nov 24 '18 at 11:17