简体   繁体   English

如何从 href 属性在浏览器中打开应用程序协议?

[英]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.

相关问题 如何从浏览器打开 windows 应用程序 - How to open windows application from Browser 如何将JavaScript结果添加到静态HTML href属性? - How do I add a JavaScript result to a static HTML href attribute? 如何在每个类中找到href属性? - How do I find the href attribute within each class? 如何打开新的浏览器标签? - How do I open a new browser tab? 如何从 href 属性获取宽度和高度 - How can i get width and height from href attribute 如果在 Python 中解析后未提取下载链接,如何从网站提取链接。 而且 href 属性是 javascript:void(0) - How do I extract link from website if after parsing in Python, the download link is not extracted. And also the href attribute is javascript:void(0) 我该怎么做<a href>?</a> - How do I do this <a href>? 如何使用自定义协议从android浏览器打开Microsoft Outlook应用程序? - How to open Microsoft outlook app from android browser using custom protocol? 浏览器如何要求打开应用程序? - How browser asks to open an application? 使用深度链接从 Web 浏览器打开 ios/android 应用程序时,如何将数据传递到移动应用程序 - When using deep linking to open an ios/android application from web browser , How can i pass data to the mobile application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM