// 经过URL后就存在这个问题
mWebView.loadUrl(URL(originalUrl).toString())
最后 使用
loadDataWithBaseURL 方式
setItem使用拼接方式 再replace替换相应的地址才解决
val mimeType = "text/html"
val encoding = "utf-8"
val injection = "<script type=‘text/javascript‘>${paramJs}window.location.replace(‘$originalUrl‘);</script>"
KLog.i("-------> ${injection}")
// "<script type=‘text/javascript‘>localStorage.setItem(‘userInfo‘, ‘\"$tokenJson\"‘);window.location.replace(‘$originalUrl‘);</script>"
mWebView.loadDataWithBaseURL(originalUrl, injection, mimeType, encoding, null) //loadDataWithBaseURL
Android9.0 Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document