[英]open custom url scheme via Spotify Apps API
From a Spotify app I want to communicate with a native application that has been registered with a custom URL scheme. 我想从Spotify应用程序与已使用自定义URL方案注册的本机应用程序进行通信。 I am testing with a clickable anchor tag 我正在使用可点击的锚标签进行测试
<a href="myscheme:/test">open custom url scheme</a>
as well as javascript code 以及javascript代码
location.href = "myscheme:/test";
which both work fine from any browser. 两者都可以在任何浏览器上正常工作。 At first, nothing happened when I clicked the link/ran the JavaScript in Spotify. 最初,单击链接/运行Spotify中的JavaScript并没有任何反应。 After extending the permissions in manifest.json to 在将manifest.json中的权限扩展为
"RequiredPermissions": [
"https://*",
"http://*",
"myscheme:/*"
]
I am getting this page in the content view for both cases (click and JS) 在两种情况下(单击和JS),我都在内容视图中获取此页面
<head></head>
<body>Error -302 when loading url myscheme:/test</body>
and the console output says 控制台输出显示
I [mainview:6886] Load complete (1) url:
I [mainview:6886] Load complete (0) url: cef-error:
Update : For the scheme mailto:
this seems to work just fine. 更新 :对于方案mailto:
这似乎很好。 Even without an explicit entry to RequiredPermissions
. 即使没有显式输入RequiredPermissions
。
Update 2 : In more recent versions (eg 0.8.4.124) clicks on links with custom URIs have no effect to the content anymore. 更新2 :在最新版本(例如0.8.4.124)中,单击具有自定义URI的链接不再对内容产生影响。 The log states: 日志状态:
W [CefAppInstance.cpp:49 ] App spotify:app:tutorial is not allowed to access resource: myscheme:/test
The mailto:
still to works without explicit RequiredPermissions
. mailto:
在没有显式RequiredPermissions
情况下仍然可以工作。
Do you have any idea? 你有什么主意吗?
不幸的是,据我所知,Apps API不支持此功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.