pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.15k stars 1.47k forks source link

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

Open hisohiso3b opened 9 months ago

hisohiso3b commented 9 months ago

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

github-actions[bot] commented 9 months ago

👋 @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!

hisohiso3b commented 9 months ago

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

gerken-tss commented 7 months ago

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.

Sumit258000 commented 1 month ago

still happening only with ios working well with android using 6.0.0

Sumit258000 commented 1 month ago

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

hisohiso3b commented 1 month ago

@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 commented 1 month ago

@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

nicks258 commented 1 month ago

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