Uncaught Syntaxerror: Unexpected Reserved Word On Older Android Version
Solution 1:
Before Android 4.4 cordova was using the old android browser (very old support of html 5).
Starting from android 4.4 the android browser was replaced by Chrome but the version of Chrome used by the webview couldn't be upgraded (version 36 for 4.4).
Since android 5.0, chrome is now in an apk and can be updated.
Arrow functions require a minimum Chrome version of 45, that's why your app doesn't work correctly on your friend's phone.
If want your app to work correctly of phones older than android 5, you can either:
- not use too recent javasctipt (check support on caniuse)
- use the crosswalk plugin to embed the webview in your app
Crosswalk was supposed to always use the latest version of chromium but unfortunatly the project is no more updated so you will not be able to use the latest javascript updates either. (latest version of Crosswalk uses chromium version 53 wich is much more recent than the 36 used in android 4.4)
The advantage of Crosswaalk is that your app has the same support of html/js/css on all device so you know how your app will behave/look like on all devices.
Using Crosswalk will lead to a much bigger APK so that's not always the best option.
You could also build two different apk versions, one for android <5.0 and one for newer.
Solution 2:
Do you know anyone who's forked the original and updated chromium to 55 or higher by chance?
Post a Comment for "Uncaught Syntaxerror: Unexpected Reserved Word On Older Android Version"