All Projects → teppeis → htmlspecialchars

teppeis / htmlspecialchars

Licence: other
Escape special characters to HTML entities in JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to htmlspecialchars

url
Build and parse URLs. Useful for HTTP and "routing" in single-page apps (SPAs)
Stars: ✭ 69 (+11.29%)
Mutual labels:  escape
jsonfiddle
JSON Fiddling
Stars: ✭ 14 (-77.42%)
Mutual labels:  escape
shell-escape-tag
An ES6 template tag which escapes parameters for interpolation into shell commands
Stars: ✭ 14 (-77.42%)
Mutual labels:  escape
zombie-escape
🏃 Gamemode for Garry's Mod based on the popular Counter-Strike: Source server mod
Stars: ✭ 17 (-72.58%)
Mutual labels:  escape
EFT Flea Market Bot
Escape from Tarkov Flea Market bot, to generate a lot of in-game currency within shortest time, while not even having to actively play the game!
Stars: ✭ 22 (-64.52%)
Mutual labels:  escape
Warri0r
ios 12 Sandbox escape POC
Stars: ✭ 32 (-48.39%)
Mutual labels:  escape
ansi-to-svg
😹 convert ANSI Escaped CLI strings to SVGs
Stars: ✭ 18 (-70.97%)
Mutual labels:  escape

htmlspecialchars NPM version bower version build status Dependency Status

Escape special characters to HTML entities in JavaScript

  • Simple
  • No dependencies
  • Available in browsers, AMD (RequireJS) and CommonJS (Node.js).

Usage

console.log(htmlspecialchars("</script>'foo!"));
// &lt;/script&gt;&#039;foo!

See test.js for detail spec.

Install

for Node.js

npm install htmlspecialchars and

var htmlspecialchars = require('htmlspecialchars');
console.log(htmlspecialchars("</script>'foo!"));

for Browsers

If you want to use the latest version simply, specify gh-pages URL directly in your script tag:

<script src="//teppeis.github.io/htmlspecialchars/index.js"></script>
<script>
console.log(htmlspecialchars("<\/script>'foo!"));
</script>

or bower install htmlspecialchars and specify the local index.js:

<script src="path/to/bower_components/htmlspecialchars/index.js"></script>

or load it with RequireJS.

Testing

This library is tested with BrowserStack Open Source Free license. Thanks!

  • IE 8, IE 11
  • Chrome
  • Firefox
  • Safari 8
  • iOS 7 Safari
  • Android 4.4 Browser

License

MIT License: Teppei Sato <[email protected]>

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].