0

I am writing a code to check if the browser is supported or not.

var sendMsg:{
 sendInfo:function(){ .. }
};
try{
        let a = async function(){
          return 10;
        };

        async function*E(...e){ }

        }catch(e_){
          alert('Please update browser');
          alert(JSON.stringify(sendMsg.sendInfo().obj,null,4) );
        }

I get script error SCRIPT1004: semicolon ; expected script error on windows 7, IE 11

Also this async* fails to load the page. on chrome 60.

I tried to add polyfills: <script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?features=es2016"></script> but didn't helped.

On top of that, i never get the alert message : Please update browser (as given in the catch statement).

shrw
  • 1,719
  • 5
  • 27
  • 50
  • 1
    Some times new language features introduce new syntaxes so you cannot use older interpreters to detect them because they trigger parse errors. Your best chance is to have a separate loader script that performs detection (by other means) or preprocess your code with a server-side transpiler. – Álvaro González May 01 '20 at 15:47
  • is there a possibility to add this check in the section somewhere; I don't have control on server side – shrw May 01 '20 at 23:13
  • 1
    You can use a transpiler in your local PC and upload the generated code; there's no need to preprocess the same static stuff every time it's requested. You have some good resources in the linked questions. – Álvaro González May 02 '20 at 08:25

0 Answers0