Questions tagged [load-order]

30 questions
344
votes
6 answers

load and execute order of scripts

There are so many different ways to include JavaScript in a html page. I know about the following options: inline code or loaded from external URI included in or tag [1,2] having none, defer or async attribute (only external…
Bergi
  • 630,263
  • 148
  • 957
  • 1,375
81
votes
10 answers

Waiting for dynamically loaded script

In my page body, I need to insert this code as the result of an AJAX call:

Loading jQuery

Using jQuery

at the bottom on line 444 not loading in the right order. When the…
fuzzybabybunny
  • 5,146
  • 6
  • 32
  • 58
3
votes
2 answers

Loading javascript after html page load

I'm trying to make sure that an external javascript file loads last on the page. The javascript file "script.js" (which controls the image slider) should be last. I suspect it's not loading last right now because my webpage is covered with a red…
1
vote
1 answer

What code in Rails is not evaluated at runtime (ie: ActiveRecord scopes, etc)

If you try to evaluate the current date in an ActiveRecord scope, it will likely be incorrect due to this being evaluated when your application code is loaded instead of at runtime. You have to pass this through in a lambda, like this: scope…
Blastula
  • 494
  • 6
  • 17
1
vote
0 answers

JavaScript - diferent execute/load-order in diferent browsers

Does anybody have any idea why the following code will be executed in different order in different browsers? Code is in an external file embedded in a plain HTML page between using
Dusko
  • 11
  • 1
1
vote
1 answer

Meteor file load order changes on mobile

In Meteor application's client folder I created js file which manipulates my template (client/index.html). It works fine when I run application locally in a browser. But when I deploy it to mobile phone my script does not work. Then I added…
MantasG
  • 223
  • 1
  • 2
  • 12
1
vote
1 answer

jQuery loading order in Wordpress

I have a jQuery script that reads img height and adds style tag to head tag. jQuery var img = document.getElementById('logomini'); height = img.clientHeight; $(function (){ $("