在Drupal 6中,页脚消息被去掉一些HTML标记。在我的例子中,我希望将<img>
与一个<map>
标记放在一起,这样图像就可以链接到不同的部分。Drupal剥离了<map>
标记,即使我将它添加到“筛选的HTML”数据类型中接受的HTML标记中。
有办法在页脚中启用<map>
标记吗?
发布于 2013-08-01 04:07:55
我假设您正在讨论一个自定义块,您将其添加到站点的页脚区域。在这种情况下,您需要包含用于创建地图图像的所有HTML标记,即<area>
、<img>
和<map>
。
我尝试过使用包含以下HTML的块。
<img src="http://www.w3schools.com/tags/planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="http://www.w3schools.com/tags/sun.htm" alt="Sun">
<area shape="circle" coords="90,58,3" href="http://www.w3schools.com/tags/mercur.htm" alt="Mercury">
<area shape="circle" coords="124,58,8" href="http://www.w3schools.com/tags/venus.htm" alt="Venus">
</map>
为过滤后的HTML输入格式启用那些HTML标记后,添加到该块页面的HTML如下所示。
<div id="block-block-1" class="clear-block block block-block">
<div class="content"><p><img src="http://www.w3schools.com/tags/planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap" /></p>
<p><map name="planetmap"><br />
<area shape="rect" coords="0,0,82,126" href="http://www.w3schools.com/tags/sun.htm" alt="Sun" /><br />
<area shape="circle" coords="90,58,3" href="http://www.w3schools.com/tags/mercur.htm" alt="Mercury" /><br />
<area shape="circle" coords="124,58,8" href="http://www.w3schools.com/tags/venus.htm" alt="Venus" /><br />
</map></p>
</div>
</div>
请记住,由于用于筛选HTML标记的函数是过滤器_xss(),所以将传递给过滤后的HTML输入格式的HTML更改为:
javascript:
)的URL。然后,调用_过滤器_xss_属性();这意味着对标记属性也进行了筛选。
https://drupal.stackexchange.com/questions/81139
复制