Electron.NET icon indicating copy to clipboard operation
Electron.NET copied to clipboard

Get Url of window

Open ru-sh opened this issue 8 years ago • 1 comments

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.

ru-sh avatar Feb 20 '18 19:02 ru-sh

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.

GregorBiswanger avatar Feb 20 '18 20:02 GregorBiswanger