How can we load a URL in webView that it wants to storing client-side data

Issue

It is my first test with webViwe.

When i run a base URL "https://baseUrl.com" in web browser it load and then URL will change to "https://baseUrl.com/login" like this :

Step one :

enter image description here

Step two:

enter image description here

But when i load "https://baseUrl.com" or "https://baseUrl.com/login" in mobile webView i just faced with step one and it never goes to step two.

This is my codes :

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

  with(webView.settings) {
        javaScriptEnabled  true
        loadWithOverviewMode  true
        useWideViewPort  true
    }
        webView.webViewClient  WebViewClient()

        webView.loadUrl("https://baseUrl/login")

    }

Solution

As i found in websites that take advantage DOM storage we should add this in setting webView :

 webView.settings.domStorageEnabled  true

Answered By – milad salimi

Leave a Comment