电子 url 方案“open-url"事件 [英] electron url scheme "open-url" event
本文介绍了电子 url 方案“open-url"事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 index.js
中做了以下操作;
I did the following in my index.js
;
electron.remote.app.on("open-url", function(event, url) {
console.log("Open URL: " + url);
});
这会在 Mac OS 中触发,但不会在 Windows 中触发.在 Windows 中是否有其他事件或不同的方式来执行它?
This gets triggered in Mac OS, but not in Windows. Is there another event or a different way to do it in windows?
推荐答案
这是一个仅限 mac 的功能.最接近的替代方法是 app.makeSingleInstance(callback).
This is a mac-only feature. The closest alternative is app.makeSingleInstance(callback).
您可以安排以 url 作为参数启动您的应用程序:myApp my-scheme://stuff
You can arrange for your app to be launched with the url as argument: myApp my-scheme://stuff
然后 callback
使用首先启动的应用程序进程中的 url 调用.
Then callback
is called with the url in whichever app process was launched first.
这篇关于电子 url 方案“open-url"事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文