2

when I try to display the image url from the api for the HTTP image tag format the image does not appear, while for https the image format appears.

the following code i use

WebView(
              initialUrl: Uri.dataFromString(
                      "<meta name='viewport' content='width=device-width,initial-scale=1,maximum-scale=1'/>"
                      "${HtmlCodeHtpp}",
                      mimeType: 'text/html',
                      encoding: Encoding.getByName('utf-8'))
                  .toString(),
                javascriptMode: JavascriptMode.unrestricted,
                onWebViewCreated: (WebViewController webViewController) {
                  _controller.complete(webViewController);
              },
            ),

the data is obtained from existing submissions, for testing I use hard code first

var HtmlCode = '<h1> h1 Heading Tag</h1>' +
      '<h2> h2 Heading Tag </h2>' +
      '<p> Sample Paragraph Tag </p>' +
      '<p><img src="https://flutter-examples.com/wp-content/uploads/2019/04/install_thumb.png" alt="Image" width="250" height="150" border="3"></p>' ;



  var HtmlCodeHtpp = '<h1> h1 Heading Tag</h1>' +
      '<h2> h2 Heading Tag </h2>' +
      '<p> Sample Paragraph Tag </p>' +
      '<p><img src="http://ditpsmp.kemdikbud.go.id/wp-content/uploads/2020/09/Irganisasi-Siswa-Intra-Sekolah-03-scaled.jpg" alt="Image" width="250" height="150" border="3"></p>' ;

this when using http format

User Image Format HTTP Url

2
  • 1
    I think you need to disable Apple Transport Security. More detail please check this link stackoverflow.com/questions/58686699/… Commented Oct 8, 2021 at 3:20
  • 1
    any solution do you get? Commented Apr 27, 2022 at 17:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.