Use case
The app I want to realize needs multiple WebViews, and inside each of them the anchor tag target property plays an important role, therefore the values should be distinguishable. In my specific case, <a href="/sitelet?url=https%3A%2F%2Fgithub.com%2Fflutter%2Fflutter%2Fissues%2FsomeURL" target="_blank"> URLs should open the link in the main browser, while <a href="/sitelet?url=https%3A%2F%2Fgithub.com%2Fflutter%2Fflutter%2Fissues%2FsomeURL" target="_self"> URLs should be opened inside the WebView. Support for "_top" and "_parent" could also be added.
Proposal
I think it would make most sense to introduce a target field, e.g., request.target, where request is of type NavigationRequest.
Snippet:
if (request.target == "_blank") {
if (await canLaunch(request.url)) {
await launch(request.url);
}
return NavigationDecision.prevent;
}
else {
return NavigationDecision.navigate;
}```
Use case
The app I want to realize needs multiple WebViews, and inside each of them the anchor tag target property plays an important role, therefore the values should be distinguishable. In my specific case,
<a href="/sitelet?url=https%3A%2F%2Fgithub.com%2Fflutter%2Fflutter%2Fissues%2FsomeURL" target="_blank">URLs should open the link in the main browser, while<a href="/sitelet?url=https%3A%2F%2Fgithub.com%2Fflutter%2Fflutter%2Fissues%2FsomeURL" target="_self">URLs should be opened inside the WebView. Support for "_top" and "_parent" could also be added.Proposal
I think it would make most sense to introduce a target field, e.g.,
request.target, whererequestis of typeNavigationRequest.Snippet: