1

Organization preloading :

<script>
var isMSIE = /*@cc_on!@*/false;

var resources = ['load.js'];

for (var i=0; i<resources.length; i++){
  if (isMSIE){
    new Image().src = resources[i];
  } else {
    var o = document.createElement('object');
    o.data = resources[i];
    document.body.appendChild(o);
  }
}
</script>

<a href="index2.html">GO</a>

(Stefanov book "Javascript Patterns")

The script is loaded on the page but will not be executed. Now if you go to the page index2.html <a href="index2.html">GO</a>

index2.html

<script src="load.js"></script>
<style>
</style>
</head>
<body>
index2 

Script to load from cache?

Which test to spend verify this ?

Michael Phelps
  • 3,451
  • 7
  • 36
  • 64

1 Answers1

0

I am not sure what you are trying to achieve, but what I currently see is that you are trying to load a javascript, yet create an object.

You need to create a script tag to make the browser load the script.

See here

If you use jQuery, you can use getScript()

Community
  • 1
  • 1
Maddis
  • 577
  • 1
  • 6
  • 19