Sanitize vimeo embed code

只谈情不闲聊 提交于 2020-01-03 05:01:09

问题


Here's the vimeo url code.

<object width="40" height="300"><param name="allowfullscreen" value="true" /><param   name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9082619&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=9082619&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="40" height="300"></embed></object><p><a href="http://vimeo.com/9082619">Queueing - One in a Dozen</a> from <a href="http://vimeo.com/enki">sideshow bob</a> on <a href="http://vimeo.com">Vimeo</a>.</p>

Here's the example from the Rails docs

  <%= sanitize @app.description, 
  :tags => %w(table tr td), 
  :attributes => %w(id class styles) %>

I want to just show the video, no height, width, title etc. I tried modifying it for the past 20 mins, but couldn't get it to work.

Any suggestions?


回答1:


It's not clear from your question what exactly you're trying to do, but try:

<%= sanitize @app.description,
 :tags => %w(a embed object p param),
 :attributes => %w(allowfullscreen allowscriptaccess href name src type value) %>


来源:https://stackoverflow.com/questions/2189497/sanitize-vimeo-embed-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!