Flutter_html: Links not opening webview

Created on 12 Dec 2018  路  1Comment  路  Source: Sub6Resources/flutter_html

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);
},

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_launcher is exactly what you need to do.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Larpoux picture Larpoux  路  3Comments

hunglv21 picture hunglv21  路  5Comments

a-href picture a-href  路  4Comments

freddoOswaldo picture freddoOswaldo  路  4Comments

raLaaaa picture raLaaaa  路  3Comments