Android 9浏览器用LinkedIn URL Scheme打开企业页失败求助
解决Android 9浏览器中LinkedIn Scheme跳转企业页的问题
正确的URL Scheme格式
LinkedIn目前仅支持通过企业ID直接跳转应用内企业页面,正确的格式是:
linkedin://company/[企业ID]
注意:必须使用企业的唯一数字ID,不能用企业名称——名称存在重名、特殊字符、空格等问题,Scheme无法识别。
如何获取企业ID
打开LinkedIn网页版的目标企业页面,URL中的数字串就是企业ID。比如页面URL为https://www.linkedin.com/company/1234567/,那么1234567就是该企业的ID。
兼容浏览器的实现方案
Android 9的应用内浏览器(如Opera、Chrome)对Scheme唤起App的逻辑有严格限制,直接用<a>标签可能出现无响应的情况,建议结合JavaScript做 fallback 处理,确保在无法唤起App时自动跳转到网页版:
<a href="https://www.linkedin.com/company/1234567" onclick="return openLinkedInCompany(event, '1234567')">打开LinkedIn企业主页</a> <script> function openLinkedInCompany(event, companyId) { event.preventDefault(); const appLink = `linkedin://company/${companyId}`; const webLink = `https://www.linkedin.com/company/${companyId}`; // 创建隐藏iframe尝试唤起App const iframe = document.createElement('iframe'); iframe.style.cssText = 'display:none;width:0;height:0;border:0;'; iframe.src = appLink; document.body.appendChild(iframe); // 2秒后判断是否唤起成功,失败则跳转网页版 setTimeout(() => { document.body.removeChild(iframe); window.location.href = webLink; }, 2000); } </script>
为什么之前的格式无效
- 旧的
linkedin://profile/company/等格式已被LinkedIn官方废弃,不再支持跳转 - 使用企业名称而非ID的格式,LinkedIn应用无法匹配到唯一的企业页面
- Android 9的应用内浏览器对非官方认可的Scheme格式会拦截,导致无法唤起应用或仅打开首页
内容的提问来源于stack exchange,提问作者LeDucSAS
相关产品推荐
相关产品推荐

