New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter web not working on iOS web (13.5.1) #144170
Comments
Hi @eliluong
Does this log come from iOS's Chrome browser inspector?
It seems you can reproduce this on your end on desktop Chrome browser as well. What is the Chrome version? Could you share the entire stack trace? |
Yes, to get access to those messages in iOS Chrome, I navigate to As for the desktop Chrome browser, I can't seem to generate that warning again (even after running build again). I am on Chrome 109.0.5414.120. I want to note that I have a copy of the web build from September 2023, which does load on my iOS Safari. I ran |
Okay, I would like to summary this as follows: On Flutter version (
Could you also share the iOS Chrome and iOS Safari's browser version on iOS |
Thank you for helping. I want to clarify, I believe there are two issues that are separate. One (I am not sure if it is important) is the warning about no service worker available. This specific issue appeared one time on Chrome desktop and disappear, like you said. I can also confirm on iOS Chrome this error ( The second issue is Flutter web app not loading on older iOS browser. I reviewed the link you provided, and will try their workaround. Would an easy solution be to change Flutter version to something lower and |
As you mentioned the build on September 2023 can load on iOS Safari, it could be a regression issue on Flutter. It would be helpful if you can do git bisect to find the bad commit on your device (I don't have a such device with that OS version so I can't check this). You can check this tutorial as an example for bisecting regression issue on Flutter. Meanwhile, I will label this for other's thoughts. |
Thanks. I am not sure a git bisect would be useful, because I build from the same code I had in September 2023 (had not touched the code until recently). I'm not 100% sure, but feel pretty confident there were no changes to the code since that time. I copied the codebase and did some code edit on a new development machine, and this was when I encountered the issue where iOS Flutter web app would not load. I made a copy of the old code on the old development machine, and ran build but the issue persists (assuming I had not updated anything Flutter-related). After having a chance to read through the WeakRef comment you posted, I followed the recommendation in #134317 (comment) and I can confirm my Flutter web app now loads in both iOS Safari and Chrome (in addition to desktop Chrome). So your idea of WeakRef being the issue is correct. Since I am a casual developer, this is fine as a workaround, as I am not making anything that serves millions of users. |
I meant As the solution shared at #134317 (comment) can solve the issue, @ditman Do you think this issue can be safely closed? |
According to https://docs.flutter.dev/reference/supported-platforms, Safari 13 is no longer supported by newer versions of the Flutter SDK. It may work, but we don't test on Safari 13 any more. The following options are available:
|
The alternative that OP used was to use a WeakRef polyfill. See their comment: |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to reproduce
I found this issue in the past (#104646), and it was marked as resolved.
I compiled an app with
flutter build web
and uploaded to a web server. It currently loads on various Chrome desktop and Chrome mobile, and iOS 15+. I have a mobile device running iOS 13.5.1 and it fails to load (just a blank page). If I insert text intoindex.html
prior to the<script>
tag in the body, I see the text appear. I do not have a desktop Safari on a similar version in order to see what it outputs to the console. I understand the older browsers only make a small fraction of current browser share. Is there a workaround I can use?I read the post, #104646 (comment), and I created a new project (same Flutter version as my project), and moved
flutter.js
over to my project build directory, but it still does not load on the older browser.I followed instructions here (https://forums.macrumors.com/threads/how-do-i-check-logs-on-ios-safari-if-i-use-windows.2373059/post-31794304) and it output the following:
WARNING Exception while loading service worker: Error: Service Worker API unavailable. DEBUG Injected <script> tag. Using callback. DEBUG Flutter Web Bootstrap: Programmatic. LOG ReferenceErrror: Can't find variable: WeakRef LOG Another exception was thrown: Instance of 'minified:eN<void>'
Additionally, I followed suggestion here to run a Flutter web app (#140786 (comment)), and one of the warnings in the console on desktop Chrome browser was this (the web app still loads and functions):
flutter.js:362 Exception while loading service worker: Error: Service Worker API unavailable. The current context is NOT secure. Read more: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts at FlutterServiceWorkerLoader.loadServiceWorker (flutter.js:130:11) at FlutterLoader.loadEntrypoint (flutter.js:360:33) at (index):59:23
Please let me know if there is a workaround for this issue, or if it is not planned to be fixed due to old browser and tiny market share. Thank you.
Expected results
Able to load on older browsers.
Actual results
Not loading on older browers.
Code sample
Code sample
[Paste your code here]
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: