Replies: 9 comments 2 replies
-
Hi Eilon, thanks for your excellent work. But I tried compiling the And the version of |
Beta Was this translation helpful? Give feedback.
-
Just wanted to chip in and say it affects iOS devices too. I've had several complaints about issues on older iPhones such as the iPhone 7. |
Beta Was this translation helpful? Give feedback.
-
same problem, the workaround worked |
Beta Was this translation helpful? Give feedback.
-
This worked perfectly! Thank you so much!! |
Beta Was this translation helpful? Give feedback.
-
Worked on iOS 15 too 😃 |
Beta Was this translation helpful? Give feedback.
-
It's safe to use in production? |
Beta Was this translation helpful? Give feedback.
-
@Eilon, we have a .NET 9 Blazor Web App which others have pointed out has the same issue with its blazor.web.js file. I was manually able to edit this file to downgrade the static syntax dotnet/aspnetcore#58212 (comment) (16 spots currently need updating) and it works. My questions are:
We have several web sites and based on the traffic for the last month it will impact 1% of our users for one site and 4.1% of our users for our second site - perhaps small numbers in the scheme of things but how do you explain a blank screen to the 1 in 25 people who try and use the site? (of those using iOS in Australia, 14% in the last month are using a version less than 16.4 according to https://gs.statcounter.com/ios-version-market-share/mobile-tablet/australia/#monthly-202502-202502-bar) We are still debating whether to go back to .NET 8 (at the cost of features like optimized static web asset delivery and the better server-side reconnection functionality), or whether to go to .NET 9 and add a warning to the login screen for the users on iOS 16.3 or less (did try checking if their browser was ES2022 compatible by checking for some ES2022 features but this wasn't suitable - it wasn't flagging iOS versions that I know don't work - maybe someone else has a better check - also this check is not perfect because I'm not checking for non-compatible Android devices but that's mainly because I'm not aware of which versions of Android play nice or not but I do for iOS), or whether to downgrade the blazor.web.js and potentially manage updates to it when there are new releases. Look forward to your feedback, thanks in advance for your time.
|
Beta Was this translation helpful? Give feedback.
-
Is there a fix for blazor.server.js ? |
Beta Was this translation helpful? Give feedback.
-
I have same problem. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've published a workaround for supporting Blazor Hybrid on older Android devices that have older WebView components. Those older WebViews support only older JavaScript versions, and are incompatible with the latest Blazor Hybrid scripts.
Here are some of the reports of this issue:
Uncaught SyntaxError: Unexpected token .
aspnetcore#53699The problem and the fix
The official version in .NET 9 has code that targets ES2022, which can produce JavaScript code that is not compatible with older Android devices. The suggestion was to target ES2019, which is compatible with older devices. One of the suggestions in those issues was to compile the
blazor.webview.js
file (which is written in TypeScript) to target that older EcmaScript (ES) version.The fix I made was to change the build of the
blazor.webview.js
file to use ES2019. To do that I changed these two versions fromES2022
toES2019
: https://github.com/dotnet/aspnetcore/blob/ecfaab9e762b14e35fc29fe2799ca458a057c14f/src/Components/Shared.JS/tsconfig.json#L3-L5And then I produced a local build of the
blazor.webview.js
JavaScript file, and included it in my .NET MAUI Blazor Hybrid app. And it worked!How to apply the fix to your app
To use the new ES2019-compatible script I followed these steps:
wwwroot\scripts
wwwroot\index.html
and at the bottom of that file change this line:And that's it!
How I tested the fix
For informational purposes, here's what I used to confirm the original bug reproduces, and then verify the fixed version.
Beta Was this translation helpful? Give feedback.
All reactions