I wasn't sure if this was the intention or a bug.
using version 0.8.2
example code
Html(
onLinkTap: (url){print('link tap: $url');},
data: """
<div>
<h1>Demo Page</h1>
<p>This is a fantastic <a href="https://www.google.com/">nonexistent product</a> that you should buy!</p>
<h2>Pricing</h2>
<p>Lorem ipsum <b>dolor</b> sit amet.</p>
<h2>The Team</h2>
<p>There isn't <i>really</i> a team...</p>
<h2>Installation</h2>
<p>You <u>cannot</u> install a <a href="https://www.google.com/">nonexistent product!</a></p>
</div>
),
result: console prints url when link is tapped
expected result: device webbrowser to be opened sending user to link
My work around is to use another package 'url_launcher' to open the webbrowser
onLinkTap: (url){
print('link tap: $url');
_launch(url);
},
Yes, tapping a link only calls the callback and is not supposed to open a browser out of the box. The goal of this package is just to provide a very simple way to render html. Anything beyond that is up to the implementer, so using url_launcher is exactly what you need to do.
Most helpful comment
Yes, tapping a link only calls the callback and is not supposed to open a browser out of the box. The goal of this package is just to provide a very simple way to render html. Anything beyond that is up to the implementer, so using
url_launcheris exactly what you need to do.