我使用Antisamy验证HTML。我的政策允许iframe,例如youtube视频。问题是 - 如果标签是空的(像这样):antisamy解析器强制关闭标记
<iframe src="//www.youtube.com/embed/uswzriFIf_k?feature=player_detailpage" allowfullscreen></iframe>
比清理它会像这样经过:
<iframe src="//www.youtube.com/embed/uswzriFIf_k?feature=player_detailpage" allowfullscreen/>
但也应该有正常的关闭标签。
并且这打破了页面上的所有内容。 我已经把我的指令,使用大多数HTML,但不XML:
<directives>
<directive name="omitXmlDeclaration" value="true"/>
<directive name="omitDoctypeDeclaration" value="true"/>
<directive name="maxInputSize" value="200000"/>
<directive name="nofollowAnchors" value="true" />
<directive name="validateParamAsEmbed" value="true" />
<directive name="useXHTML" value="false"/>
<directive name="embedStyleSheets" value="false"/>
<directive name="connectionTimeout" value="5000"/>
<directive name="maxStyleSheetImports" value="3"/>
<directive name="formatOutput" value="false"/>
</directives>
但这没有帮助。
UPD:在解析器之间切换并使用指令播放仍然没有给出任何结果。
UPD2:这是我的配置的一部分,负责处理iframe
标签:
<tag name="iframe" action="validate">
<attribute name="src">
<regexp-list>
<regexp name="youtube"/>
<regexp name="slideshare"/>
</regexp-list>
</attribute>
<attribute name="allowfullscreen">
<regexp-list>
<regexp name="anything"/>
</regexp-list>
</attribute>
<attribute name="scrolling">
<regexp-list>
<regexp name="anything"/>
</regexp-list>
</attribute>
<attribute name="marginwidth">
<regexp-list>
<regexp name="anything"/>
</regexp-list>
</attribute>
<attribute name="marginheight">
<regexp-list>
<regexp name="anything"/>
</regexp-list>
</attribute>
<attribute name="frameborder">
<regexp-list>
<regexp name="anything"/>
</regexp-list>
</attribute>
<attribute name="style"/>
</tag>
任何想法?
我知道4年过去了....但不管怎样,可以你记得你是否设法解决这个问题?抓住最后两天的吸管 – Rohan210