You should always use <\/script>
if you want to put </script>
in a string in JS, because </script>
marks the end of the tag no matter where it shows up.
You should always use <\/script>
if you want to put </script>
in a string in JS, because </script>
marks the end of the tag no matter where it shows up.
I solved it by splitting the script tag like this SO question recommends:
doc.write("<scr"+"ipt>var app = \"" + _2d() + "\";</scr"+"ipt>");