Electron.NET
Electron.NET copied to clipboard
Get Url of window
Is it possible to get the url of a window? I'm trying to detect if browser was redirected and find out where it was redirected.
Hey @ru-sh,
use from the chrome dev tool the console and type:
window.location.href
Another way is to send you the information over the IPC... As example:
Your HTML-View:
<script>
var { ipcRenderer } = require("electron");
ipcRenderer.send("currentUrl", window.location.href);
</script>
Your C# Part:
public IActionResult Index()
{
Electron.IpcMain.On("currentUrl", (url) =>
{
// Here you get the url from url parameter
});
return View();
}
I hope my answer helps you.