pass iframe through sanitize

74 views
Skip to first unread message

Grigory Antonov

unread,
Mar 24, 2012, 2:56:34 AM3/24/12
to rubyonra...@googlegroups.com
Hello,
I want to let users place in textfield an iframe tag from google maps.
Sanitize cuts everything. I want to  add some kind of rule to sanitize, so it cuts js, but pass through an iframe from google maps and yandex maps
Tried to place in  config config.action_view.sanitized_allowed_tags = %w('iframe') . It didn't help.
sample 

Shlomi Zadok

unread,
Apr 2, 2012, 4:48:46 PM4/2/12
to Ruby on Rails: Talk
In config/initializers/sanitizer.rb

add:

HTML::WhiteListSanitizer.allowed_tags << 'iframe'

On Mar 24, 9:56 am, Grigory Antonov <antono...@gmail.com> wrote:
> Hello,
> I want to let users place in textfield an iframe tag from google maps.
> Sanitize cuts everything. I want to  add some kind of rule to sanitize, so
> it cuts js, but pass through an iframe from google maps and yandex maps
> Tried to place in  config config.action_view.sanitized_allowed_tags =
> %w('iframe') . It didn't help.
> sample
> <iframe width="650" height="300" frameborder="0" scrolling="no"
> marginheight="0" marginwidth="0"
> src="http://maps.google.ru/maps/ms?hl=ru&gl=ru&ptab=2&ie=UTF8&..."></iframe>
Reply all
Reply to author
Forward
0 new messages