Skip to content

Conversation

@hdijkema
Copy link
Contributor

With this code change, the call to bind(, "", ),
will also catch the navigation event for GtkWebKit (linux WebView).

So no need anymore for an navigation handler, unless one would
want to implement this as a feature for all webview / browser variants.

will also catch the navigation event for GtkWebKit (linux WebView).

So no need anymore for an navigation handler, unless one would want
to implement this as a feature for all webview / browser variants.

Signed-off-by: Hans Dijkema <hans@dijkewijk.nl>
Signed-off-by: Hans Dijkema <hans@dijkewijk.nl>
@AlbertShown
Copy link
Member

I did it in a different way (13a9d5a).
Can you please test latest main Branche in Linux?

@hdijkema
Copy link
Contributor Author

hdijkema commented Oct 22, 2025

I did it in a different way (13a9d5a). Can you please test latest main Branche in Linux?

Hi AlbertShown,

I've reviewed your code. No need for testing yet I'm afraid, because you're missing one point:

When one sets new content manually (with some show form), be it HTML or a URL or a file, GtkWebKit will also generate a decide-policy signal. If its going to be ignored, the content will not be set, but the page will be cleared and the connection to the GtkWebKit window will be lost (i.e. no webui.js loaded).

So you can´t always ignore the policy signal. Sometimes you must allow it.

You can also not reliable trust the navigation_type to be WEBKIT_NAVIGATION_TYPE_OTHER, because WEBKIT_NAVIGATION_TYPE_OTHER will also be the type if one sets window.location.href in javascript.

So a lot of corners and bends to be considered when catching this behaviour.

If you look at my solution, you can see that whenever something is shown programmatically, a flag is set, which is reset in the navigation handler. This ensures that GtkWebKit loads the provided HTML/Url/File as one would expect when one sets the content explicitly.

@hdijkema
Copy link
Contributor Author

If you want, I can take your current work and work on it to get it working the way it should. Would that be a good idea?

@hdijkema
Copy link
Contributor Author

I've added some changes to your code to make it work. Closing this pull request.

@hdijkema hdijkema closed this Oct 22, 2025
@AlbertShown
Copy link
Member

If you want, I can take your current work and work on it to get it working the way it should. Would that be a good idea?

Yes of course, that will be great, and thank you for that.
I'm not doing any macOS/Linux testing right now as I'm focusing on finishing some WebView2 issue on Windows.

@hdijkema
Copy link
Contributor Author

If you want, I can take your current work and work on it to get it working the way it should. Would that be a good idea?

Yes of course, that will be great, and thank you for that. I'm not doing any macOS/Linux testing right now as I'm focusing on finishing some WebView2 issue on Windows.

I've finished this change. See pull request #659.

@hdijkema hdijkema deleted the navigation_v2 branch October 22, 2025 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants