Reputation: 4178
<\/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.
Upvotes: 0
Views: 143
Reputation: 182819
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.
Upvotes: 5
Reputation: 2420
It’s simply </script>
with the forward slash escaped so it doesn’t get automatically encoded by the document.write()
function.
Upvotes: 2
Reputation: 15673
escape character to insure slash outside of the quoted text is not encoded.
Upvotes: 2