tryphotino / photino.NET

https://tryphotino.io
Apache License 2.0
895 stars 73 forks source link

Retrieve current Url of PhotinoWindow? #197

Open nicholas-brooks opened 3 months ago

nicholas-brooks commented 3 months ago

Is there a way of retrieving the current url of a PhotinoWindow instance? Something like:

mainWindow.GetCurrentUrl()

We're looking to save the current state when the user closes the app so we can restore it when they launch it again.

MikeYeager commented 3 months ago

@nicholas-brooks We don't currently have this functionality, though we would consider adding it when time permits. As a work-around, you can use JavaScript to monitor navigation events and send those to C# via window.external.sendMessage() calls and save the current value for use upon closing.

nicholas-brooks commented 3 months ago

Thanks @MikeYeager. Happy to help add this feature in - any pointers in doing so?

MikeYeager commented 3 months ago

@nicholas-brooks We have to implement the feature in the C++ code for Windows (Win32), Linux (GTK) and Mac (Cocoa) in the Photino.Native project. In each case we'll have to hook into the native web view control and handle the navigation events, and store the URL in a local variable. Then we can add a call like the one you described to the interface to retrieve that value. Are you a C++ developer? We always appreciate help!

nicholas-brooks commented 2 months ago

@MikeYeager - Thanks for the response. I haven't done C++ development for a very long time but that wouldn't stop me from contributing.