I am trying to use WebView for making an url to work in my app in Android Studio. The link is basically having a .js extension so, I have provided the following code in my MainActivity.kt file.
myWebView.settings.javaScriptEnabled
myWebView.loadUrl("https://wordsmith.org/words/quote.js")
myWebView.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(
view: WebView,
request: WebResourceRequest
): Boolean {
view.loadUrl(request.toString())
return true
}
}
And I have also entered the following code into my AndroidManifest.xml file in order to give access to internet.
<uses-permission android:name="android.permission.INTERNET" />
Still the WebView isn't working as it shall. Is there something that I'm missing out or any else solutions?
Click here to check out the WebView code in my XML code and Design snippet
CodePudding user response:
You have to enable javascript like this:
myWebView.settings.javaScriptEnabled = true
CodePudding user response:
Try this:
myWebView.settings.javaScriptEnabled = true
myWebView.settings.domStorageEnabled = true
