Stripe browser compatible - javascript

Doing cross-browser support using a Iphone 5s emulator running safari 10 and under I noticed some code is not supported.
https://github.com/stripe-samples/accept-a-card-payment/blob/master/using-webhooks/client/web/script.js
When going through the error logs, I found that 'fetch' is not supported in that browser so I installed a polyfill
and that required 'promise' so I installed another polyfill
and now I'm getting an error with this code:
.then(function({ stripe, card, clientSecret }) {
The curly brackets aren't supported, I am not sure where to go with this, if there is a straight forward fix or should I try to recode this .js file without using polyfills.

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.

How to debug JavaScript errors when running a Cordova App on Android TV

I have written a Javascript script which I bundled into an Android app using Cordova.
The code is written in ES6 and is transpiled into ES5 using Babel and Webpack.
The app is intended to run on a simple TV, so I am using MK809 Android dongle to transform a TV into an Android-based TV. Then I install the new app and try to run it.
The problem is that the app terminates immediately (most probably due to some ES5 errors as the transpilation is probaby not complete or correct).
Is there a way this can be debugged?
When I run it on my computer's Chome, everything works perfectly as it has full ES6 support. The app also runs perfectly on my Android phone as it uses a modern browser which supports ES6.
I am not a FE guy, so my knowledge is a bit limited.
Can anyone suggest the best way to debug this? How can I run a local copy of a brower with ES6 disabled so that I could easily spot the problem?
Thank you
The only I see you could achieve this would be to root this Android dongle and install something like ADBWifi so you can debug it through Chrome/ADB over your local network. This is what I do for ChromeOS devices, not too sure if it's doable with your device...
I found out that using a service like errlog.io gives me what I need.
JavaScript errors get captured and sent to the their service and then are accessible on the dashboard
see: Get Started with Remote Debugging Android Devices
the MK809 dongle has an USB port and it would need to have USB debugging enabled.
then go to chrome://inspect on the computer's Chrome, in order to access the debugger.
logging and debugging is something very else; that dongle actually is a Rockchip RK3066.

How to debug Node.js with Firefox?

I'm aware of how to access the Chrome Dev Tools with Google Chrome to debug Node.js applications: just go to about://inspect.
I encountered a line of text on MDN mentioning that Firefox could be used for Node.js applications, but going to about://inspect in Firefox doesn't work. I'd like to know how this would be done in Firefox, if it is indeed possible.
Because Firefox uses a different Javascript engine (Gecko) than Node.js (V8), it's impossible to use the Firefox dev tools to debug Node scripts. As of this post, MDN says as much in their "Remote Debugging" article:
You can connect the developer tools to Gecko-based runtimes...
https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging
There's a tool called node-firefox that you can use for that, you can download it from:
npm install node-firefox
Here's the source code: https://github.com/mozilla/node-firefox
And a introductory guide: https://hacks.mozilla.org/2015/02/introducing-node-firefox/

Meteor: Can’t get updates to Android Emulator (Hot Code Push)

I'm doing mobile development on an Android Emulator with Genymotion. I can't get any code changes to show up on the emulator. I always get this error, even on Startup:
Skipping downloading new version because the Cordova platform version or plugin versions have changed and are potentially incompatible
I know this a protection mechanism from bad updates, but It happens all the time. I can't even make a small CSS or JS change. They all get blocked. I tried it on Android 4.4.4, 5.0 and 6.0.
I'm using Meteor 1.4.1.2 and I simply run meteor run android-device and it pops up on the Genymotion device.
Anyone know what's causing this?

Webpack + React and Google Chrome 43.0.2357.65

After updating Google Chrome (v. >= 43.0.2357.65) error was displayed in console: Uncaught SyntaxError: Unexpected token function in different places of my bundle.js.
It appears only when bundle.js returns 200 http status. But after refresh page this file returns 304 http status and all works fine without errors. I'm using webpack v.1.8.5 and React v.0.13.2
In other browsers code works fine, and in Google Chrome before update it works fine.
See this Chrome issue and this related Twitter conversation from the person who filed it.
If you're using an older version of Node.js in your build, updating it might fix this. From the issue:
broken.js was the result of a build script running in Node.js 0.10.18, which seems to have written the file with some peculiar character encoding issues

Categories