[英]How do I open an application protocol in browser from a href attribute?
I am trying to call an app protocol from a href browser url, eg href = "mailto://", and it should open the mail client eg on windows.我正在尝试从 href 浏览器 url 调用应用程序协议,例如 href = "mailto://",它应该打开邮件客户端,例如在 windows 上。
However, I am setting up my html with lodash templates, and the href attribute somehow always sets a "http://" before the url..: "http://mailto://" therefore it does not work anymore, so in lodash templates, I am trying string preparation to just give me the protocol, but I get an empty href attribute then as a result... why?但是,我正在使用 lodash 模板设置我的 html,并且 href 属性总是在 url 之前设置一个“http://”..:“http://mailto://”因此它不再起作用了,所以在 lodash 模板中,我正在尝试字符串准备只是给我协议,但结果我得到一个空的 href 属性......为什么? This is my lodash snippet:
这是我的 lodash 片段:
<p id="element<%- el.id %>" style="padding-left: 10px; padding-right: 10px;">
<a href="<% el.link.substr(0,7) == 'http://' ? el.link.replace('http://', '') : el.link %>" alt="favApps" target = "_blank"><%- el.title %></a>
</p>
EDIT: It was my fault, as I was using a third-party plugin, there was a security-reason that blocked opening of app protocols, thats why http://
was added and #blocked
to unknown protocols...编辑:这是我的错,因为我使用的是第三方插件,有一个安全原因阻止了应用程序协议的打开,这就是为什么
http://
被添加并#blocked
到未知协议......
I was using a third-party plugin, there was a security-reason that blocked opening of app protocols, thats why http:// was added and #blocked to unknown protocols...我正在使用第三方插件,有一个安全原因阻止了应用程序协议的打开,这就是为什么 http:// 添加和#blocked 到未知协议...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.