If an ad shows up properly in Firefox, Safari, Opera but an error "Object Expected" in Internet Explorer. The following scenario: an HTML file contains this inline JavaScript code to load remote.js and call a function in remote.js
And in the file remote.js:
You would expect the output in this order:
- Before loading remote.js
- After loading remote.js
- In remote function
IE gives an error message "Object Expected" because it calls the function remoteFunction() prematurely. It calls before loading the file remote.js, which contain the declaration of remoteFunction(). This is another unexpected behavior from IE. Fortunately, it can be corrected by adding the attribute defer="defer" to second script invocation. This will specifically prevent IE from executing and actually produce proper result. Other browsers are not affected by the change.
Was this information helpful?
Yes /
No