Firefox中启用自定义协议:解决PDF内外部应用链接无法点击问题
Firefox PDF阅读器无法打开自定义协议链接的问题
我需要在Firefox浏览器的PDF文件中打开指向外部应用的自定义协议链接,例如 zotero://select/library/items/3DKDWDRD,但这类链接在Firefox的PDF内无法点击(Safari、Chrome等浏览器无此问题)。手动在地址栏输入该链接时,可正常唤起外部应用。
链接元素结构对比
通过HTML检查器查看PDF内的元素,发现自定义协议链接的结构如下:
<section data-annotation-id="714R" tabindex="1000" style="z-index: 0; left: 27.0271%; top: 24.0591%; width: 10.0752%; height: 1.65675%;" class="linkAnnotation" id="pdfjs_internal_id_714R"></section>
而可正常点击的HTTPS链接结构为:
<section data-annotation-id="714R" tabindex="1000" style="z-index: 0; left: 27.0271%; top: 24.0591%; width: 10.0752%; height: 1.65675%;" class="linkAnnotation"> <a data-element-id="714R" title="https://doi.org/10.1007/s11244-009-9251-z" href="https://doi.org/10.1007/s11244-009-9251-z" target="" rel="noopener noreferrer nofollow" id="pdfjs_internal_id_714R"></a> </section>
可见自定义协议链接未生成对应的<a>标签,这是无法点击的核心原因。
已尝试的解决方案
我使用的是macOS系统下的Firefox 132.0.2版本,已知自定义协议可能受硬编码白名单限制,但找不到白名单位置。已在about:config中添加以下设置,未解决问题:
"network.protocol-handler.app.zotero": "/Applications/Zotero.app/Contents/MacOS/zotero", // 手动输入链接可正常工作,此设置可能多余 "network.protocol-handler.expose.zotero": false, "network.protocol-handler.external.zotero": true
提问
是否有办法让Firefox允许PDF内的这类自定义协议链接正常点击?
内容的提问来源于stack exchange,提问作者user21101711
相关产品推荐
相关产品推荐

