'Android WebView Uncaught ReferenceError when executing js
I got a website inside a WebView. The website has a external js file SOMESCRIPT included by script tag which hosts class SOMECLASS. I want to display a overlay by calling SOMECLASS.showLayer().
This works perfectly if I call it from the site itself by adding it as onclick to a button like <a href="#" onClick="SOMECLASS.showLayer();">
It doesn't work if I call it from my WebView by doing view.evaluateJavascript('SOMECLASS.showLayer()') or view.loadUrl('javascript:SOMECLASS.showLayer()') in onPageFinished of my WebViewClient.
Chromium displays Uncaught ReferenceError: SOMECLASS is not defined in logcat.
I tried using jQuery.getSCript(url_to_somescript, function() { SOMECLASS.showLayer() })), got the same error.
Any Idea what I could be missing?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
