Ability to choose the target for opening in wasm
Azorlogh opened this issue · comments
For projects such as bevy_egui, it would be useful to be able to choose the target when opening a url.
I saw that it can be changed at compile time, but it's not enough for this use case, egui provides a Hyperlink
widget which, in order to behave and feel like a native hyperlink needs to open in _self
when left clicking and _blank
when using modifiers.
The usecase makes sense to me.
I'd avoided doing this in the past, because the behaviour cannot be guaranteed across browsers. But I'm beginning to think something like BrowserOptions::target_hint
might be better. The hint
part hopefully makes it obvious that it isn't a guaranteed behaviour, while still giving that flexibility in platforms like wasm.
Does this work for you? If yes, would you like to open a PR? If not, I'll put something up in the next 5-7 days.
I think this should work! I'll open a PR.