gpt4 book ai didi

javascript - 如何从 Electron BrowserWindow对象获取当前URL?

转载 作者:行者123 更新时间:2023-12-03 12:21:15 71 4
gpt4 key购买 nike

我想知道browser-window的当前URL。有什么方法可以访问BrowserWindow的window.location.href属性,或有其他方法可以获取它吗?

最佳答案

在主要过程中,使用窗口的webContents。 getURL()方法:

[...]
win = new BrowserWindow({ /* options */});
win.loadFile('index.html');
console.log (win.webContents.getURL();)

另请: How to get the url of the BrowserWindow?

关于javascript - 如何从 Electron BrowserWindow对象获取当前URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56001835/

71 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com