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 8246225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:26:10+00:00 2026-06-07T22:26:10+00:00

I have the following code layout <script src=http://some.javascript/file.js></script> // This should load first <script

  • 0

I have the following code layout

<script src="http://some.javascript/file.js"></script> // This should load first
<script language="JavaScript">
    document.write('<SCR'+'IPT language="JavaScript1.1" SRC="http://a.link.to.an.external.url/that/returns/a/full/html/page/including/some/javascript">'); // This should load second
    document.write('</SCR'+'IPT>');
</script>

MyJavascriptFunctionThatDependsOnStuffLoadedFromThe.documentWritePage(); <!-- Those files above should have loaded before this call -->

I know that it looks weird. Let’s assume that it HAS to look like that for reasons that don’t affect how the JS gets loaded. This does not need to work across browsers — just WebKit browsers.

How do I make sure each of those documents loads completely before the next one? That is, how do I make sure that these documents load synchronously so that the function call at the end can assume appropriate state?

  • 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-07T22:26:13+00:00Added an answer on June 7, 2026 at 10:26 pm

    JavaScript files should load sequentially and block so unless the scripts you are depending on are doing something unusual all you should need to do is load application.js after the other files.

    Cross-domain scripts are loaded after scripts of site itself, this is why you get errors.

    You could add event listener and load your js files on this event, something like this:

    function addJavaScript( js, onload ) {
       var head, ref;
       head = document.getElementsByTagName('head')[0];
       if (!head) { return; }
       script = document.createElement('script');
       script.type = 'text/javascript';
       script.src = js;
       script.addEventListener( "load", onload, false );
       head.appendChild(script);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code $this->addScript('<script type=text/javascript> $(document).ready(function() { alert(dsf); }); </script>'); Is it
I have implemented the following code from this page: http://tympanus.net/codrops/2010/06/02/smooth-vertical-or-horizontal-page-scrolling-with-jquery/ $(document).ready(function() { $('ul.navone li
I have the following code in a controller: $this->viewdata->scripts = array( 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', 'jstree/jquery.jstree-1.0-rc2.js', 'jquery.hotkeys-0.8.js',
In my Zend Framework app, I have following code: index.php $app_started_time = time(); layout.phtml
I have the following layout : And following code : public class MailSenderActivity extends
I have a table layout with the following code <table cellspacing=0 class=photogalleryTable> <tbody> <tr>
For my project I have added following line of code in applicaiton.ini resources.layout.layoutPath =
I have following code i want that window opened uses Ext.layout.BorderLayout and also on
I have written the following in a JavaScript method : <html> ... <script type=text/javascript
I have the following code: <div dojoType=dijit.layout.ContentPane id=filterForm style=padding: 3px> <form dojoType=dijit.form.Form> <input dojoType=dijit.form.TextBox

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.