本文介绍了如何从浏览器启动外部应用程序,例如电报网址链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当一个人访问电报用户配置文件页面时,我试图用电报重新创建以下应用程序启动。例如:
I am trying to recreate the following application launch with telegram when one visits the telegram user profile page. Example: https://t.me/username1
页面加载后,会显示一个警告框以打开电报应用程序。如何在网页上将其重新创建为URL链接?另外,他们如何在页面加载时执行此操作,它在源代码中位于何处,以便我可以看到它?
When the page is loaded, it gives an alert box to open the telegram app. How do I recreate this as a URL link on a webpage? Also how are they doing this on page load and where is it in the source code so I can see it?
推荐答案
使用 tg
就像使用 mailto
tg://resolve?domain=username1
<a href="tg://resolve?domain=username1">Message me!</a>
发送至启动页面加载,只需使用标准的并重定向浏览器;
To launch it page load, just use the standard DOMContentLoaded and redirect the browser;
document.addEventListener("DOMContentLoaded", function(event) {
window.location.href = "tg://resolve?domain=username1";
});
我已经搜索了很长时间才能找到任何文档,有一个从1年前开始,但是他们只共享了。
I've searched quite some time to find any documentation, there is one reddit post from 1 year ago, but they only shared the 'source file'.
这篇关于如何从浏览器启动外部应用程序,例如电报网址链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!