0
我想根据参数获取URL中的参数以显示消息,但这不适用于android WebView。JS URL API在android webview中不起作用
// JS in webview web page
// document.location = https://www.test.com?login=true
var url_string = document.location;
var url = new URL(url_string);
// url.searchParams.get('login') gives true
if (url.searchParams.get("login") === 'true') {
$('#login-modal').modal('show');
}
任何有用的解决方案和答案将不胜感激!
我建议你修改你的问题,显示的URL是什么,以及你如何使用它与'WebView'。 – CommonsWare
@CommonsWare已编辑! –
你有没有在你的web视图中启用JavaScript默认情况下它未启用使用'webview.getSettings()。setJavaScriptEnabled(false); webview.getSettings()。setJavaScriptEnabled(true);' – Xenolion