2

So here is the situation, i'm getting an ad from my custom adserver like so

src = 'http://www.adserver.com/www/delivery/ajs.php?zoneid=1&cb=37930400855&charset=UTF-8&loc=http%3A//thissite.com/';
script = document.createElement 'script'
script.type = 'text/javascript'
script.src = src
$('.banner-container').append script

So the problem is the url is correct in the src variable it is correct when it is inserted into the dom

<script type="text/javascript" src="http://www.adserver.com/www/delivery/ajs.php?zoneid=1&amp;amp;cb=37930400855&amp;amp;charset=UTF-8&amp;amp;loc=http%3A//thissite.com/"></script>

But the second the browser tries to fetch it the url changes to

http://www.adserver.comwww/delivery/ajs.php?zoneid=1&cb=37930400855&charset=UTF-8&loc=http%3A//thissite.com/

see right after the .com it strips the / so that comwww runs together, making it throw an error and of course not display what i want. I have tried uri encoding and other little things i had read or seen on stackoverflow to no avail.

cheshirecatalyst
  • 379
  • 1
  • 5
  • 14
  • 1
    if i run the script, nothing gets renamed. – Luke May 22 '14 at 23:55
  • also if i just put it into the window it works. it is a redirect bug on their site. – Luke May 23 '14 at 00:00
  • @Luke do you realize that the url in the question has been anonymized? That's surely not the *actual* script the OP is using. It would be silly to post something identifying like that in stackoverflow. – 000 May 23 '14 at 00:02
  • so you are saying, that if it were a browser issue, the browser would identify which urls are anonymized and which not, and just make the error with a non anonymized url? – Luke May 23 '14 at 00:04
  • 1
    No, I mean that cheshirecatalyst doesn't want everyone here to see their private url like `http://google-adwords.com/my-private-id/whatever`, so they changed it around a bit. – 000 May 23 '14 at 00:06

1 Answers1

1

Perhaps the problem is on the ad server site. They likely have a bad rewriterule, or a bad internal redirect. I have run your sample code with a different domain and it works fine.

Try visiting the js url in your browser directly, or using a command line tool like curl. Check that it is redirecting. So it is likely that the adserver.com site is redirecting badly. If they have a support contact, you should file a ticket with that company.

I am sorry that this does not directly solve your problem, but I feel that this response is a proper "answer" for this site.

000
  • 26,951
  • 10
  • 71
  • 101