简体   繁体   中英

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.

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? This is my lodash snippet:

<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...

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM