Created
September 20, 2019 13:06
-
-
Save batica81/b981e4ac0474f66da8d5cb075e6332c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A simple way to protect from some XSS attacks | |
var sanitizeHTML = function (str) { | |
var temp = document.createElement('div'); | |
temp.textContent = str; | |
return temp.innerHTML; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment