Msencenb
Msencenb

Reputation: 5104

Rails render raw html but escape javascript?

So I have some user generated content areas of my site. I want them to be able to use html for markup purposes, but I don't want them to be able to execute any arbitrary javascript.

From my understanding raw() will just output everything, html, javascript, and all right into the webpage.

Is there a method that will allow raw rendering of html but not allow rendering of javascript?

Upvotes: 1

Views: 2006

Answers (1)

Behrang Saeedzadeh
Behrang Saeedzadeh

Reputation: 47923

Have a look at sanitize.

Upvotes: 1

Related Questions