# Sanitize doesn't remove inner html

**URL:** <https://www.ruby-forum.com/t/sanitize-doesnt-remove-inner-html/146211>\
**Category:** Rails\
**Created:** [August 19, 2008, 3:30am UTC](https://www.ruby-forum.com/t/sanitize-doesnt-remove-inner-html/146211 "2008-08-19T03:30:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [August 19, 2008, 3:30am UTC](https://www.ruby-forum.com/t/sanitize-doesnt-remove-inner-html/146211/1 "2008-08-19T03:30:10Z")

</div>

Hi -

If I have a forbidden tag, like :

extra stuff

I’d like the whole thing removed. Sanitize just removes the and \</  
a\> tags. Is there any easy way to remove the whole thing with  
sanitize?

Thanks,  
Dino

---

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [August 19, 2008, 3:38pm UTC](https://www.ruby-forum.com/t/sanitize-doesnt-remove-inner-html/146211/2 "2008-08-19T15:38:09Z")

</div>

On Mon, Aug 18, 2008 at 9:29 PM, dino d. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> sanitize?
> 
> Thanks,  
> Dino

The sanitizer is only going to remove the content of the tag if it’s  
considered a “bad” tag (like ). You can add tot he list of bad  
tags  
by throwing this at the bottom of environment.rb

Rails::Initializer.run do |config|  
config.action\_view.sanitized\_bad\_tags = %w(a strong table)  
end

Brandon

## –

Sessions by Collective Idea: Ruby on Rails training in a vacation  
setting  
[http://sessions.collectiveidea.com](http://sessions.collectiveidea.com)
