如何在 Electron.js 中记录活动浏览器的 url?

问题描述 投票:0回答:1

我有一个 electro.js 应用程序,它使用 active-win 来记录当前打开的窗口。在 macOS 上,这还包括当前窗口的 url。但是,任何其他操作系统似乎都不支持此功能。我想看看是否有一个包/方法可以获取当前打开的窗口的 url(如果它是浏览器),以便我可以记录它。

提前致谢,如果这个问题已经被提出/回答,我很抱歉 - 我在网上查了很长一段时间,找不到任何明确的解决方案。

我考虑过使用浏览器扩展、其他 npm 包、使用 Windows 的可访问性 api,但似乎都不是一个很好的选择。

来自

active-win

的示例输出
{
        title: 'Unicorns - Google Search',
        id: 5762,
        bounds: {
            x: 0,
            y: 0,
            height: 900,
            width: 1440
        },
        owner: {
            name: 'Google Chrome',
            processId: 310,
            bundleId: 'com.google.Chrome',
            path: '/Applications/Google Chrome.app'
        },
        url: 'https://sindresorhus.com/unicorn', /* this will never show on windows or linux, ie. what I want to recreate in some form*/
        memoryUsage: 11015432
    }
node.js electron active-window
1个回答
0
投票

不可能。我不知道是什么让你想到这样的事情。你是你血脉的耻辱

© www.soinside.com 2019 - 2024. All rights reserved.