flutter_inappwebview icon indicating copy to clipboard operation
flutter_inappwebview copied to clipboard

I get white out when I try to display an Iframe with srcdoc attribute and src=dataurl. InAppWebView(iOS17)

Open hisohiso3b opened this issue 1 year ago • 8 comments

  • [x] I have read the Getting Started section
  • [x] I have already searched for the same problem

Environment

Technology Version
Flutter version 3.7.11
Plugin version 5.8.0 / 6.0.0 beta31
Android version
iOS version 17.1.2
macOS version 14.0
Xcode version 15.0.1
Google Chrome version

Device information:

Description

Expected behavior:

it should display iframe contents

Current behavior:

it displays blank screen

Steps to reproduce

if I try to display the following iframe with InAppWebView, the content will be blank.

https://jsfiddle.net/6bo8drk1/

  1. This
  2. Than that
  3. Then

Images

Stacktrace/Logcat

no error on web inspector console log

hisohiso3b avatar Dec 07 '23 14:12 hisohiso3b

👋 @hisohiso3b

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

github-actions[bot] avatar Dec 07 '23 14:12 github-actions[bot]

I found solution. https://stackoverflow.com/questions/41250162/wkwebview-not-loading-content-from-iframe-on-a-webpage

hisohiso3b avatar Dec 08 '23 10:12 hisohiso3b

I have the same error and I fear @hisohiso3b's solution does not work. While it prevents the error, it also prevents loading the content of the iframe, at least for me. In my case, I am loading a TinyMCE editor. This only applies to iOS, not to Android.

gerken-tss avatar Jan 22 '24 07:01 gerken-tss

still happening only with ios working well with android using 6.0.0

Sumit258000 avatar Jul 18 '24 07:07 Sumit258000

@hisohiso3b can you post your answer I am not comfortable with swift code.

Sumit258000 avatar Jul 18 '24 12:07 Sumit258000

@Sumit258000

This issue is occurring because the Swift implementation of the inappwebview library does not consider iframes and is blocking all iframe communications.

As suggested in the Stack Overflow answer, allowing communications for frames other than the main frame (i.e., iframes) by using decisionHandler(.allow) will enable the communications.

I cloned the library locally and made the fix directly. However, it is too cumbersome, and I do not recommend this approach at all. I suggest contacting the developers, creating a pull request, or considering migrating to a library that does not have this issue.

hisohiso3b avatar Jul 18 '24 14:07 hisohiso3b

@pichillilorenzo

but, inappwebview is pretty libraly. love it. best libraly. really reduce my larger time,,thankyou.. and maybe someone recreate all of their code,, I almost gave up

hisohiso3b avatar Jul 18 '24 17:07 hisohiso3b

@hisohiso3b I would appreciate if you could share your branch or code as I have no knowledge of Swift. Thanks

nicks258 avatar Jul 22 '24 12:07 nicks258