Help Center > Troubleshooting > Problems with Ad Serving

What is "Object Expected" error in Internet Explorer?

If an ad shows up properly in Firefox, Safari, Opera but it shows an error "Object Expected" in Internet Explorer, you need to verify the ad code. This error usually happens in the following scenario. An HTML file contains an inline JavaScript to load remote.js and call a function in remote.js
<script text="text/javascript">
<![CDATA[
alert('Before loading remote.js');
document.write('<sc'+'ript type="text/javascript" src="remote.js"><\/script>');
alert('After loading remote.js');

// call a remote function that should be already be declared
document.write('<sc'+'ript type="text/javascript">remoteFunction();<\/script>');
]]>
</script>
And in the file remote.js:
function remoteFunction() {
   alert('In remote function');
}
You would expect the output in this order:
  1. Before loading remote.js
  2. After loading remote.js
  3. 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 in order to give a correct output. Other browsers are not affected by the change.

Other Articles in Problems with Ad Serving

Instructions to troubleshoot and correct issues with ad serving
Search Help Center
There was a problem with your submission. Please correct the following items:

    Cannot find an answer for your question? Ask our Customer Care team

    Related Articles

    • Campaign i
      "Documentation for API methods to manage one or multiple campaigns. API Version1.2.11 (build 20121221). This page was updated on Mon, ..."
    • Advertiser i
      "Documentation for API methods to manage one or multiple advertisers. API Version1.2.11 (build 20121221). This page was updated on Fri, ..."
    • Channels i
      "Documentation for API methods to manage one or multiple channels. API Version1.2.11 (build 20121221). This page was updated on Fri, ..."
    • Website i
      "Documentation for API methods to manage one or multiple websites. API Version1.2.11 (build 20121221). This page was updated on Fri, ..."

    Have questions? Contact Us

    Testimonials for our Ad Servers

    • This is the best information I have read yet. I have a fairly new website and growing, but I wanted to get my feet wet in the ad space game. Your advice and information was spot on. It gave me a great base to work with when selecting from my different options.

      Dana P
      Palmer Events

    • I'm very pleased with AdSpeed! I'm one of the many former OpenX OnRamp users who've had to scramble to find a new ad server. I'm very glad I found you. Set up was very easy and the ads are served very fast! SO much better than OpenX ever was.

      Beckie M
      St. Louis Sprout & About