0

We are trying to implement ads on our website. We send a javascript call to the ad server which in turn returns javascript as response.

The returned javascript is in as follows:

document.write('<scr'+'ipt type="text/javascript" src="http://ad.doubleclick.net/adj/;net=wfm;u=,wfm-21344506162_1343958067,1290bc3a7d845dc,health,ax.10-wfm.hliv_l-wfm.health_l-bv.am-bv.ax-bv.b77-bv.b21-bv.b26-bv.c18-bv.b76-bv.c44-bv.b7-bv.b48-bv.c22-bv.c4-bv.b79-bv.c9-bv.c17-bv.c39-bv.c12-bv.c3-bv.b13-bv.a65;pos=top;ugc=0;!c=aaa;tile=1;sz=300x250;cmw=owl;contx=health;cmd=www.abc.com;an=10;bu=109;br=390;btg=wfm.hliv_l;btg=wfm.health_l;btg=bv.am;btg=bv.ax;btg=bv.b77;btg=bv.b21;btg=bv.b26;btg=bv.c18;btg=bv.b76;btg=bv.c44;btg=bv.b7;btg=bv.b48;btg=bv.c22;btg=bv.c4;btg=bv.b79;btg=bv.c9;btg=bv.c17;btg=bv.c39;btg=bv.c12;btg=bv.c3;btg=bv.b13;btg=bv.a65;ord=114194322"></scr'+'ipt>');

The issue is happening when viewing the website within the company vs outside the company. For the same javascript within companys network throws the following error

Resource interpreted as script but transferred with MIME type text/html

When viewed outside company's network, the ad displays fine.

Any insights on why this could be happening

Jared Farrish
  • 48,585
  • 17
  • 95
  • 104
fn79
  • 303
  • 6
  • 18
  • 1
    Check the headers the response are being transmitted with. – mariusnn Aug 03 '12 at 02:00
  • 2
    The error seems pretty descriptive. You should emit `Content-type: text/javascript`. – Jared Farrish Aug 03 '12 at 02:02
  • thanks for the reply. The response is returned from some external vendor on which I do not have control. can I just set the content type in my page? – fn79 Aug 03 '12 at 02:09
  • Is it ``? Or is it an `iframe`? How is it being included? If it's Ajax, you can't get Javascript and run it (without JSONP or CORS, which aren't really relevant here) without `eval()`ing, which you *should not do*. – Jared Farrish Aug 03 '12 at 02:12
  • its not iframe. just the code I have pasted above. and strangely the file which contains the above code does not end in .js. – fn79 Aug 03 '12 at 02:15
  • How do you get the code itself? Are you calling it with ` – Jared Farrish Aug 03 '12 at 02:16
  • no. we send out javascript code with the ad server URL, and the server responds with the above pasted code. If you check the code above, it has some more links which contains similar javascript. the fact that it works when viewed from home is driving me crazy in fixing the issue when its not working internally – fn79 Aug 03 '12 at 02:19
  • Post all of your markup. You're not understanding what I'm asking. – Jared Farrish Aug 03 '12 at 02:19
  • yes, your right, the file URL reference is what you have posted. I cant post the entire markup here...sorry about that – fn79 Aug 03 '12 at 02:24
  • I think you need to contact the ad service's tech support. You might try putting ` – Jared Farrish Aug 03 '12 at 02:28
  • Push comes to shove, you could [parse out the `src` attribute](http://jsfiddle.net/WxRTD/) from the response. I'd ask them what you should be doing different, though. – Jared Farrish Aug 03 '12 at 02:30
  • ok, thanks Jared. I will try some of your suggestions and post back here – fn79 Aug 03 '12 at 02:42

0 Answers0