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