Ram
Ram

Reputation: 15

Approach XSS prevention on Html page using javascript

How to escape textbox contents of form using javascript(not jsp page) to avoid xss.It must be redered properly on page while submitting form.

Upvotes: 0

Views: 190

Answers (2)

Plap
Plap

Reputation: 1056

"Insert the text into the document using document.appendChild, document.createTextNode and friends instead of a property (such as innerHTML) that accepts raw HTML."

as Quentin says, or, using an existing textbox, use the value property:

textObject.value="value"

Upvotes: 1

Quentin
Quentin

Reputation: 944216

Insert the text into the document using document.appendChild, document.createTextNode and friends instead of a property (such as innerHTML) that accepts raw HTML.

Upvotes: 2

Related Questions