Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

htmlspecialchars

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

htmlspecialchars

Escape special characters to HTML entities in JavaScript

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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 <teppeis@gmail.com>

Keywords

FAQs

Package last updated on 07 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc