如何显示Excel,Docs,pdf ..使用WebView Android中的cookie

发布于 2025-01-28 04:40:27 字数 750 浏览 0 评论 0原文

我正在尝试通过通过cookie显示 excel file(在线),但只有一个空白的白页。

它适用于 txt 文件,因此也许通过cookie不是问题。

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)

我还尝试了此( android Webview,显示PDF通过Google Viewer通过Cookie 提交文件),但无效。

我该如何解决问题?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文