'How to show excel, docs, pdf.. with passing cookies in webview Android

I'm trying to show excel file(online) in a webview with passing cookies, but only get a blank white page.

It works fine for txt file, so maybe passing the cookie is not the problem.

webView.webViewClient = WebViewClient()
webView.settings.setSupportZoom(true)
webView.settings.javaScriptEnabled = true

val cookieManager = CookieManager.getInstance()
cookieManager.setAcceptCookie(true)
cookieManager.setCookie(url,cookie)
cookieManager.setAcceptThirdPartyCookies(webView, true)
cookieManager.flush()
webView.loadUrl(url)

I also tried this(Android WebView, show pdf file via Google Viewer with passing cookies) but it didn't work.

How can I solve the problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source