Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8809919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:59:42+00:00 2026-06-14T02:59:42+00:00

I’m making a simple javascript game engine for fun, and I’m running into a

  • 0

I’m making a simple javascript game engine for fun, and I’m running into a kind of annoying problem while working on it.

Currently the way I’m including javascript files is by having an index.html page that calls my javascript “main”, and includes all my javascript files with <script type="text/javascript" tags in the <head> section.

This is working reasonably well, except that maybe 1 in 6 or so refreshes of the page it fails to load one of the javascript files. I get an error like: GET http://localhost:8000/js/Input.js. It works fine when all the files are combined together and minified, so I assume this has something to do with asynchronous loading of the files and the game starting before everything is loaded? I’m not sure though. I’m including about 25 files right now, and the problem seems to be getting worse as I add more.

Is there a better way to include javascript files? I’m trying to make this as easy to work on as possible so I don’t want to have to do a ton of server-side stuff. (Currently I’m just using the SimpleHTTP server command in python)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:59:44+00:00Added an answer on June 14, 2026 at 2:59 am

    If the error is an HTTP error, and the URL is exactly the same when it fails as when it succeeds, then the problem is not related with your JS but with your web server.

    However, if you are using something like $.getScript and the error is related to some not initialized variable, you are probably looping through all your scripts to be included and executing a getScript for each one of them. If so, as getScript uses an AJAX request to load the JS, the execution order of the scripts is not guaranteed. To solve this, and if you don’t mind the performance hit as it seems this case is only when running on your development environment, you can chain the requests so no request is made before the previous (required) JS file is loaded, thus sequentially executing your script files:

    var dfr = $.Deferred().resolve();
    var scripts = ["script1.js", "..."];
    
    $.each(scripts, function(i, script) {
        dfr = dfr.pipe(function() {
            $.getScript(script);
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm making a simple page using Google Maps API 3. My first. One marker
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the
I used javascript for loading a picture on my website depending on which small
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.