Answer the question
In order to leave comments, you need to log in
How to save cookies of visited sites in webView?
Hello!
package com.example.test
import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebViewClient
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
webViewSetup()
}
@SuppressLint("SetJavaScriptEnabled")
private fun webViewSetup() {
wb_WebView.webViewClient = WebViewClient()
wb_WebView.apply {
loadUrl("https://test.ru")
settings.javaScriptEnabled = true
}
}
override fun onBackPressed() {
if (wb_WebView.canGoBack()) wb_WebView.goBack() else super.onBackPressed()
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question