Uncaught SyntaxError: Unexpected reserved word on older android version - javascript

I am programming an app using cordova and testing it on android 8.0.0 it works fine.
But on my friend's phone (android 4.4.4) it does not work, I got these errors in the console log.
Uncaught SyntaxError: Unexpected reserved word Widget.js:9
Uncaught SyntaxError: Unexpected reserved word Image.js:8
Uncaught SyntaxError: <unknown message reserved_word> Button.js:7
Uncaught SyntaxError: <unknown message reserved_word> TextArea.js:8
Uncaught SyntaxError: <unknown message reserved_word> Effect.js:8
Uncaught SyntaxError: Unexpected reserved word View.js:9
Uncaught SyntaxError: <unknown message reserved_word> User_interface.js:8
Uncaught SyntaxError: <unknown message reserved_word> Communication.js:8
Uncaught SyntaxError: <unknown message reserved_word> App.js:7
Those errors block on the keyword "class"
Uncaught SyntaxError: Unexpected token ) index.js:16
and also block on :
AndroidFullScreen.immersiveMode(()=>{},()=>{});
Here I think it doesn't recognize the arrow function but i'm not sure.
I would like to know if I can fix it or the phone is just too old for my app?
If you need other information tell me and I will provide them :)
Thanks in advance

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.

Do you know anyone who's forked the original and updated chromium to 55 or higher by chance?

Related

Asto SSR generated code doesn't run on older versions of iOS

I am hosting astro SSR site on Netlify. It works well everywhere except when I test on iPhone 6 and older. Basically all script executions are stopped and the site is no longer interactive.
Errors from Safari on iPhone 5SE Simulator:
[Error] SyntaxError: Unexpected token '.'
[Error] The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored.
[Error] The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored. (x2)
[Error] Unhandled Promise Rejection: SyntaxError: Unexpected token '?'
[Error] Unhandled Promise Rejection: SyntaxError: Unexpected token '?'
I am not really sure how to fix this issue. Any help would be appreciated.
PS: I used svelte for building astro islands and google recaptcha(v3) in the page that is being tested. The page works fine on development environment.
This sounds like you have some code using optional chaining, e.g. object?.potentiallyMissingProperty. Per caniuse, this only works on iOS Safari versions 13.4 and later. An iPhone 6 can only install iOS 12, so using this syntax will throw an error on those devices.
This appears to be an issue within Astro, which does not support some older browsers. Astro also scopes CSS with :where, which will also break on older versions of Safari. On those browsers, your page's HTML should render, but any JavaScript will not work and should be treated as a progressive enhancement.

Unhandled JS Exception: Unexpected token '<' no stack

I started facing an issue with running my react native application in iOS device
Unhandled JS Exception: Unexpected Token '<' no stack
This started happening after i generated the main.jsbundle in react native application using the below curl command
curl http://localhost:8081/index.ios.bundle -o main.jsbundle
and added this file in xcode project. This seems to like an issue with parsing of the main.jsbundle file which i added in react-native.
Prior to the above process i tried running the application with localhost:8081 for finding the jsbundle but doesn't help me for ios devices. Code in my develop branch is working fine, but same develop code in my feature branch doesn't work with main.jsbundle.
Did anyone faced similar issue with running react native code in iOS devices.
The response you're getting is most likely in HTML format, which starts with a <. When you try to parse this response (presumably with res.json()) an exception is thrown, because a json string cannot start with a <
Try debugging your program and check exactly what the response you're getting is

Angular - iOS Blank Pages

I've just installed Angular and I'm facing two blank page problems:
1) Blank Angular.io Website On iOS 7
My iPad (running iOS 7) just sees a blank page when I try to load the Angular.io website, both via Safari and Chrome apps. I thought iOS 7 is supported by Angular (source), isn't it? It does display properly on my iPhone running iOS 9.
It is important that the Angular website I will build can be viewed properly on older devices too, so I wanted to know if it has problems supporting iOS 7.
2) Blank Mobile Page With Ng Serve
I installed the Angular test app and I can see the test page fine on my computer browsers (both local and networked computers).
However, if I load it on my iPhone or iPad, the page is completely blanked, both on Safari and Chrome apps. I do see the tab's title "My App", so it is able to connect properly to my ng serve --host 0.0.0.0 but the page just does not render. It does render fine on my Android 7 device's stock & Chrome browsers.
I've connected my iPhone / iPad's Safari to my Mac's Safari inspector, and got the following errors when loading the My App demo page:
[Error] SyntaxError: Unexpected token 'const'
../../node_modules/webpack-dev-server/client/index.js?http://0.0.0.0:0 (vendor.bundle.js:514)
__webpack_require__ (inline.bundle.js:55)
(anonymous function) (main.bundle.js:66)
__webpack_require__ (inline.bundle.js:55)
webpackJsonpCallback (inline.bundle.js:26)
As for Angular.io website, the following error shows:
[Error] ReferenceError: Can't find variable: WeakMap
LMZF (main.7d151f1f7f0a94ae41e1.bundle.js:1:142339)
n (inline.ad7fd106f6c55b1fd8ed.bundle.js:1:106)
cDNt (main.7d151f1f7f0a94ae41e1.bundle.js:1:284246)
n (inline.ad7fd106f6c55b1fd8ed.bundle.js:1:106)
(anonymous function) (main.7d151f1f7f0a94ae41e1.bundle.js:1:2317)
n (inline.ad7fd106f6c55b1fd8ed.bundle.js:1:106)
webpackJsonp (inline.ad7fd106f6c55b1fd8ed.bundle.js:1:430)
I tried searching around and some solutions mentioned about updating webpack-dev-server, enabling polyfills, or changing tsconfig.json to es5, all of which I tried but it didn't seem to work.
Can someone please advise? Thanks.

Errors trying to build Cordova Window app

I have a cordova application that runs fine on android, iOS and wp8. Now we would like it to run on windows. I have added the platform using the following command
cordova platform add windows
This adds all the plugins for me, now i build the project using
cordova build windows
For some reason my plugins and other basic features are not working. For example, i have the following cordova plugins installed
cordova plugin list
org.apache.cordova.splashscreen 1.0.0
org.apache.cordova.statusbar 0.1.10
org.apache.cordova.console 0.2.13
org.apache.cordova.camera 0.3.6
I havent tried camera yet, but upon my application starting, i try to hide the splash screen and status bar, and i get these errors
Exception was thrown at line 96, column 9 in
ms-appx://MY.APP.ID/www/plugins/org.apache.cordova.statusbar/src/windows/StatusBarProxy.js
0x800a138f - JavaScript runtime error: Unable to get property
'hideAsync' of undefined or null reference
and
Exception was thrown at line 82, column 9 in
ms-appx://MY.APP.ID/www/plugins/org.apache.cordova.splashscreen/www/windows8/SplashScreenProxy.js
0x80004002 - JavaScript runtime error: No such interface supported
I have even tried to show a console.log, which never shows anymore? I know in WP8 projects you have to change the DEFINE DEBUG flag, but i cannot find this on the new windows project.
To get round console, i thought i would try and show an alert, which you can do with
(new Windows.UI.Popups.MessageDialog("Content", "Title")).showAsync().done();
But i get an error message of
Exception was thrown at line 47, column 9 in
ms-appx://com.measure2improve.m2ianywhere/www/plugins/org.apache.cordova.dialogs/src/windows/NotificationProxy.js
0x80070005 - JavaScript runtime error: Access is denied.
I am obviously missing something here, if someone could let me know what i have missed, would be very much appriecated.

What is a V8Exception error?

I'm not sure what this error is coming from, nor what it is or what it means. Here is the error I get:
[ERROR] : V8Exception: Exception occurred at undefined:1: Uncaught SyntaxError: Unexpected token u
Now, I am creating an HTML 5 Cross platform (Android/iOS) application using Titanium Studio IDE. I'm not sure if this is an Android specific error or a Titanium Studio specific error. I know it can't be iOS because I only get this error when I am trying to test the app on Android tablet. (The app installs and runs on the device though).
NOTE: The code I am working on is proprietary so I can't show it. But what I'm mostly interested in an explanation of this error. Generally, What is this error and when does some one come across it?

Categories