JavaScript-safe string variable

If you have a bunch of funky data to store in a JavaScript string, for example some HTML, you have to be careful to “escape” all the special characters so it doesn’t break your script.

Or you can just use my web data encoder and choose “JavaScript-safe” variable:

web data encoder

You can also use other encodings, such as encodeURIComponent to make a complex URL safe to pass as a component of another URL.

Web Data Encoder for JavaScript-safe variables

Leave a Reply