Browse Source

Create a method to escape HTML in JavaScript.

pull/8142/head
maliming 5 years ago
parent
commit
d32c1b2500
  1. 7
      npm/packs/core/src/abp.js

7
npm/packs/core/src/abp.js

@ -684,6 +684,13 @@ var abp = abp || {};
document.cookie = cookieValue;
}
/**
* Escape HTML to help prevent XSS attacks.
*/
abp.utils.htmlEscape = function (html) {
return typeof html === 'string' ? html.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;') : html;
}
/* SECURITY ***************************************/
abp.security = abp.security || {};
abp.security.antiForgery = abp.security.antiForgery || {};

Loading…
Cancel
Save