-
-
Notifications
You must be signed in to change notification settings - Fork 941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The desktop app will default open link in browser #133
Conversation
wait please, I will add a |
I use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start, but I'd like to see this code moved into the event handler instead of setattribute.
We use listener multiplexing - so there's only one click handler for the whole app. Adding more handlers to the app manually might interfere with our global handling.
Instead of having this code here, we need it to either go in the Rust side where we receive events from webview, or in the AddEventListener code where we create the global listeners.
Additionally, instead of the "browser-open" attribute, we should just look at the URL itself and make the decision automatically. If it starts with a protocol (ie wry:// or dioxus:// - or anything that's not http:// or https://) then we want the url to move through the handler infrastructure.
Also - any onclick in Desktop should have "default prevented" - that way we don't need to mess with window.location. By calling "prevent default", the history will be preserved properly, so we can still provide links into a desktop app from the outside.
To recap:
- Move rpc.call into the "add event listener"
- Always call "prevent-default" for onclick events in desktop
- Parse URL or "prevent_default" attribute instead of "browser-open" flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a check that href isn't null/undefined and then remove the console.log and we're good to go :)
Looks great :) Thank you! |
No description provided.