Click here to Skip to main content
15,434,532 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I trying to load scripts from live server using JavaScript, but it doesn't loading sequentially, its a synchronous script but it working like asynchronous means does not block page rendering , executes scripts parallel, I don't know why? I need to find a reason for why this happening. I am using google chrome.
Scripts like
<script src="core.js" type="text/javascript"></script>

What I have tried:

I searching so many ways to know , why this happening but can't able to find it reason
Updated 5-Jan-21 6:03am
Richard MacCutchan 5-Jan-21 4:14am    
Since we have no idea what scripts you are referring to, what they are supposed to do, etc., it is impossible to answer.
vamsi08 5-Jan-21 4:40am    
Its a normal script like
<script src=”core.js” type=”text/javascript”></script>
Richard MacCutchan 5-Jan-21 4:42am    
Sorry, that means nothing. Please use the Improve question link above show your code and explain exactly what the problem is and where it occurs. The more information you provide, the better chance there is that someone will be able to help you.

1 solution

If you're got more than one script tag, all that does is tell the browser to download that script from the server. There is no way to guarantee that scripts will be downloaded and executed in the order specified. It's whichever script finishes downloading first gets executed first.

Your only solution is to rewrite the scripts so there are no interdependencies that require a set script order. Perhaps combining the script code into one file would be appropriate?

Don't take this as the solution because we don't know anything at all about your scripts.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900