Browse Source
Merge pull request #8142 from abpframework/maliming/htmlEscape
Create a method to escape HTML in JavaScript.
pull/8159/head
Alper Ebicoglu
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
0 deletions
-
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, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"') : html; |
|
|
|
} |
|
|
|
|
|
|
|
/* SECURITY ***************************************/ |
|
|
|
abp.security = abp.security || {}; |
|
|
|
abp.security.antiForgery = abp.security.antiForgery || {}; |
|
|
|
|