Reputation: 305
I have been trying to call a JavaScript function called showMenu();
from an Android WebView. However, I have tried what many articles on StackOverflow say about doing
webview.loadURL("javascript:showMenu()");
and it shows this in the console:
I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError: showMenu is not defined", source: https://url.com/index.php (1).
I am new at Android and I am pretty sure it is a simple fix, but I could not find it anywhere. How can I do this?
EDIT: JavaScript is enabled
Upvotes: 1
Views: 1479
Reputation: 305
I removed the function from the <script>
tags, and put it in a .js
file using 'use strict';
and worked :)
Upvotes: 0