Skip to content Skip to sidebar Skip to footer

Android Webview - Uncaught Referenceerror In Local Javascript Execution

Hello everyone and thanks for your help! I want to build a Android Webview App, it uses HTML + CSS + javascript with no library except the highcharts one. It works perfectly well c

Solution 1:

This is definitely an error in the javascript code. Namely, as I'm using an old device (tablet must be from early 2010's), the webview is not compliant with Javascript ECMAScript 6. Instead, you should make sure your code is Javascript ECMAScript 5 compliant.

This includes (those are the main errors I found in my code):

1) Don't use default parameters declaration in functions. Instead of:

functionmyFunction(myParam='hello'){
        ...
    }

Use:

functionmyFunction(myParam){
        myParam=myParam || 'hello';
        ...
    }

2) Your functions should not hold the same "name" (case-sensitive) as an id in your html. For instance don't do this:

    <a id="MyLink" onclick="MyLink();">My link</a>

But do this:

    <a id="MyLink" onclick="myLink();">My link</a>

3) If like me, you're not a damn pro, prepare to test every single line of your code, because even some things as simple as console.clear() weren't compliant.

I will edit this post as I find some more obvious errors.

Post a Comment for "Android Webview - Uncaught Referenceerror In Local Javascript Execution"