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.1k stars 1.4k forks source link

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

Open tejHackerDEV opened 1 year ago

tejHackerDEV commented 1 year ago

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.

github-actions[bot] commented 1 year ago

đź‘‹ @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!

pichillilorenzo commented 1 year ago

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?

tejHackerDEV commented 1 year ago

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 commented 1 year ago

@pichillilorenzo any update on this?

ReallySmallSoftware commented 6 months ago

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 commented 6 months ago

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...

omarjericho31 commented 5 months ago

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..

AnikethFitPass commented 1 week ago

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