I need to catch that error so that i can render the app in simple HTML way for the environment having such error types. Is there a way, so that i can catch that error?
Asked
Active
Viewed 710 times
0
-
I don't think we can catch the error as the error is thrown while the code is being parsed and not while it's running. For more information, you could refer to [this thread](https://stackoverflow.com/questions/5963045/can-syntax-errors-be-caught-in-javascript). Did you get this error when running react app in IE 11? If so you should check if you used ES6 syntax or anything that not compatible with IE and should try to import polyfills to make the react app working in IE. – Yu Zhou Nov 12 '19 at 03:14
-
Actually i have tried polyfills and they worked for IE11 but for lower versions i need to render a plain HTML page to show message for user that Your browser is not latest etc, for that i need to catch those errors. And thank you for the response! – Osama Abid Nov 12 '19 at 05:56
-
You could detect the browser version and if IE<11 then render some messages you need. You could refer to the accepted answer in [this thread](https://stackoverflow.com/questions/52736265/can-i-render-warning-message-if-users-browser-is-not-supported/53149880#53149880). You could modify the javascript function detecting browser support according to your requirement. – Yu Zhou Nov 12 '19 at 08:09
1 Answers
0
the issue is by default the application was being rendered on IE7 that is not on only IE IE11/EDGE that support the transpiled build. So I had to mention the meta information to let browser know that the intended browser is IE11/edge. Add this in the head section of your index.html:
Now may be you will get some error in console that reads:
SCRIPT5009: 'Set' is undefined
refer for the link for above error
Link: https://reactjs.org/docs/javascript-environment-requirements.html

Aravind
- 129
- 1