0
<\/script>

This is how it is used:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>

I got this from initializr.

James Kyle
  • 4,138
  • 4
  • 28
  • 41
  • See the answers on this post: [How can JavaScript make new page that contains more JavaScript?](http://stackoverflow.com/questions/2004995/how-can-javascript-make-new-page-that-contains-more-javascript) – Wesley Murch Feb 08 '12 at 05:39
  • An explanation here http://stackoverflow.com/questions/236073/why-split-the-script-tag-when-writing-it-with-document-write – Christophe Feb 08 '12 at 05:44

3 Answers3

5

The backslash prevents the browser from seeing a </SCRIPT> tag which would end the Javascript. Javascript will eat it, so the output will be </SCRIPT> as desired.

Kijewski
  • 25,517
  • 12
  • 101
  • 143
David Schwartz
  • 179,497
  • 17
  • 214
  • 278
2

escape character to insure slash outside of the quoted text is not encoded.

dbrin
  • 15,525
  • 4
  • 56
  • 83
2

It’s simply </script> with the forward slash escaped so it doesn’t get automatically encoded by the document.write() function.

Arnold
  • 2,390
  • 1
  • 26
  • 45