flutter_inappwebview icon indicating copy to clipboard operation
flutter_inappwebview copied to clipboard

Flutter InAppWebView not working in Web (after deploying to production)

Open tejHackerDEV opened this issue 2 years ago • 8 comments

I tried beta version ^6.0.0-beta.20 to show web view in Flutter Web but everything works fine in local but when deployed in Firebase hosting, no error is coming up & also nothing is getting loaded in the WebView.

tejHackerDEV avatar Dec 07 '22 05:12 tejHackerDEV

👋 @tejHackerDEV

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 '22 05:12 github-actions[bot]

Did you check the browser console log? Use the “inspect element” feature and check for any log, such as JavaScript error or if the web_support.js has been loaded correctly. Could you share the URL where the iframe should be loaded?

pichillilorenzo avatar Dec 07 '22 08:12 pichillilorenzo

I can share the url but it requires login credentials needed to enter into the website. So for now I can share the url that I am accessing in the web view

https://view.officeapps.live.com/op/view.aspx?src=

Pass any valid file link to the src

tejHackerDEV avatar Dec 07 '22 08:12 tejHackerDEV

@pichillilorenzo any update on this?

tejHackerDEV avatar Dec 08 '22 05:12 tejHackerDEV

Did you get past this? I am seeing this also but I have done a little digging and can report the following:

If I do a flutter build web --profile and change the firebase.json from source: '.' to public: 'build/web' and deploy then it works.

If I do a flutter build web --release and deploy then it fails.

A null related error is being generated in the main.dart.js - I imagine in the inAppWebView code but because it is minified I don't know for sure.

In the profile build there is a warning in the console about an iframe being able to escape the sandbox but I don't if that is related.

ReallySmallSoftware avatar Jan 06 '24 16:01 ReallySmallSoftware

I hesitate to suggest this is actually working but I changed the firebase tools to run

flutter build web --release --source-maps

instead of just

flutter build web

I also tried

flutter build web --release

I've tried a few times and it seems like the addition of the --source-maps allows the page to render correctly. This of course makes it even hard to try and understand what is going on...

ReallySmallSoftware avatar Jan 07 '24 17:01 ReallySmallSoftware

I hesitate to suggest this is actually working but I changed the firebase tools to run

flutter build web --release --source-maps

instead of just

flutter build web

I also tried

flutter build web --release

I've tried a few times and it seems like the addition of the --source-maps allows the page to render correctly. This of course makes it even hard to try and understand what is going on...

This actually worked! Thank you! However I still don't know what is the original issue, which is not good..

omarjericho31 avatar Feb 08 '24 23:02 omarjericho31

Adding " " this tag at the end of the head tag in index.html worked for me , earlier it was at the beginning of the head tag . flutter build web --release also working fine

AnikethFitPass avatar Jul 19 '24 13:07 AnikethFitPass