我使用的是AEM 6.1 SP2,我试图在锚标签的href中启用'tel‘属性,以使单击调用功能工作。我已经添加了“htmlRules”节点,并将htmlRules节点下的“协议”属性链接为“htmlRules:,mailto:,file://”。
validateHref函数在rte.js中读取'protocols‘属性并验证'tel’属性是否有效,但不确定为什么'tel‘属性在作者对话框中单击'ok’时不会在标记中持久化。
这是锚标-
<a style="color: #6c6c6c; text-decoration: underline;" class="tel" href="tel:1234 567 891">1234 567 89</a>
它就是这样在页面上呈现为标记的-
<a style="color: rgb(108,108,108);text-decoration: underline;" class="tel">1234 567 89</a>
这是“htmlRules”节点xml -
<htmlRules jcr:primaryType="nt:unstructured">
<serializer jcr:primaryType="nt:unstructured">
<cleanup jcr:primaryType="nt:unstructured">
<pre
jcr:primaryType="nt:unstructured"
tagsToRemove="[\0]"/>
<post
jcr:primaryType="nt:unstructured"
tagsToRemove="[\0]"/>
<paste
jcr:primaryType="nt:unstructured"
tagsToRemove="[\0]"/>
</cleanup>
</serializer>
<links
jcr:primaryType="nt:unstructured"
protocols="[http://,https://,ftp://,tel:,mailto:,file://]"/>
</htmlRules>
发布于 2017-08-01 00:58:30
这是固定的覆盖was保护配置文件在-
/libs/cq/xssprotection/config.xml
至
/app/cq/xssprotection/config.xml
并在regexp列表中添加“tel”属性
<regexp name="telURL" value="tel:[0-9]+"/>
<attribute name="href">
<regexp-list>
<regexp name="onsiteURL"/>
<regexp name="offsiteURL"/>
<regexp name="telURL"/>
</regexp-list>
</attribute>
这已在以下博客中描述:
尽管在那个博客和其他地方都提到过
https://forums.adobe.com/thread/2329552
为了美观起见,配置文件出现在-
/libs/sling/xss/config.xml
而不是在
/libs/cq/xssprotection/config.xml
即使我用的是漂亮的组件,
/libs/wcm/foundation/components/text/text.html
即使这样,在/libs/sling/xss/config.xml上覆盖配置文件也没有任何效果,我不得不在/libs/cq/xssprotection/config.xml上覆盖该文件。我使用的是AEM6.1 SP2。AEM的神秘方式
发布于 2017-07-28 11:42:25
您在问题中链接的解决方案似乎不适用于AEM的最新版本。
现在负责从href
开始删除tel
的机制是HTL保护,它在编写之前扫描属性。避免这种情况的最简单方法是在富文本组件中禁用它:${properties.text @ context='unsafe'}
。不过,这不是最安全的解决方案,最好用以下步骤扩展XSS保护配置:
/libs/cq/xssprotection/config.xml
-> /apps/cq/xssprotection/config.xml
/libs/sling/xss/config.xml
-> /apps/sling/xss/config.xml
<regexp name="telURL" value="tel:[0-9]+"/>
telURL
添加到锚点href
属性的regexp-list
中:<regexp name="telURL"/>
在出现问题的情况下,您可以在这个博客页面和这个堆叠溢流柱上更多地了解它。
此外,链接检查机制可能仍然标记您的链接无效的编辑模式,并在发布时,它可以被删除。
如果您需要它来使其工作到应用程序中的一个或所有特定的锚或所有锚,您可以:
x-cq-linkchecker="skip"
属性添加到锚中,正如i.net在帖子下面的注释中所建议的那样tel
添加到页面上任何可能的锚点,请在Day CQLinkCheckerService OSGI服务中添加异常tel:
特殊链接前缀。请注意,服务配置需要应用于所有作者和发布实例。发布于 2017-07-28 11:59:10
我们已经按照您共享的引用链接进行了相同的操作,但是我们正在从对话框中传递"href“值。前href=“电话:${properties.propertyname}”。或者您可以尝试类似于href="${properties.propertyname}“,并从对话框"tel:123456789”中传递值。不知道这会不会对你有帮助。谢谢。
https://stackoverflow.com/questions/45371683
复制相似问题