-4

This page should display a Google ad.

I Tried everything but it's not working. I think that the problem is with the closing script tag - </script>.

Can you please copy the source code and test it?

I really couldn't make the ad appear till now even if it's working outside the javascript code.

gdoron
  • 147,333
  • 58
  • 291
  • 367
user1341839
  • 75
  • 1
  • 13

1 Answers1

1

You have a </script> embedded inside a JavaScript string literal which is interpreted as the end of <script> tag by the browser. There are simple workarounds, the simplest one is to split any </script> present inside a string literal using the + sign:

<script type="text/javascript">
var a = "</scr" + "ipt>";
</script>

Looking at your page however, I doubt if the above changes will be enough. Instead of using .innerText:

  1. use document.createElement to create a div (and script) element
  2. use element.appendChild to append that div inside another element
Salman A
  • 262,204
  • 82
  • 430
  • 521
  • I've improved it a bit - [link](http://101greatgoals.com/geoip-test.php) Still not what I want. The JS files are not showing their code like this. – user1341839 Jun 20 '12 at 13:03
  • You're close. You can use `$.getScript` to load JavaScript files dynamically (e.g. after you have determined that the country is not US). This function also provides callback support, so you can call your render ad function inside the callback. – Salman A Jun 20 '12 at 14:58