-
Notifications
You must be signed in to change notification settings - Fork 57
$.xss()
Arthur Guiot edited this page Jul 4, 2017
·
1 revision
This function is basically a function to prevent Cross-site scripting. So what this function does is that you give it a string and it returns you the same string but with encoded special characters.
It's super simple, you just need to give it a string, like that:
// Creating DisplayJS variable
var $ = new DisplayJS(window);
// String we want to encode
var str = "<b>After conversion, I won't be interpreted as HTML 😊</b>";
// Executing the function
var result = $.xss(str)
// printing the result
console.log(result)
Want to send GET data but you can have html in it? Instead of $.xss()
, just use $.xssURI()
. It works exactly the same as $.xss()
.
Don't hesitate to ask your questions
- Home
- The Core Languages
- Getting Started: Installation
- The Basics (
$.var()
+$.target()
) - Developing for DisplayJS
-
$.select()
- Text related
- If...else
$.xss()
$.repeat()
$.custom()
$.live()
$.load()
$.on()
$.onEvent()
$.ready()
- Scroll API
$.all()
$.clone()
$.is()
$.valEmpty()
$.remove()
$.show()
&$.hide()
$.ajax()
- Class Related
$.css()
$.getStyle()
- Fade effects
$.extend()
$.dynamic()
$.parent()
- Elements-Nodes
$.component()
$.time_ago()
$.copy()
$.then()
$.sleep()
$.getProp()