0

Possible Duplicate:
Why split the <script> tag when writing it with document.write()?

I don't really do Javascript programming and was hard to google this but have seen something like this in a couple of different places (by good developers):

document.writeln('<scr'+'ipt src="'+pcheck+'" type="text/javascript"></scr'+'ipt>');

With the split always between the r and the i. What does this achieve?

Community
  • 1
  • 1
timpone
  • 19,235
  • 36
  • 121
  • 211

1 Answers1

0

This is to prevent any script blockers from loading this script, because they cannot find the "script" word within the text.

TheHippo
  • 61,720
  • 15
  • 75
  • 100
  • 1
    That may be a side effect but is not the intention. It allows the browser to render a page with script-generated script. It doens't matter where the split is as long as the browser is not given ' – Dan Iveson Aug 09 '10 at 13:14
  • @DanIveson is right. The correct reason is explained here: http://mths.be/etago – Mathias Bynens Feb 13 '12 at 12:24