是否有可能在web视图设置自定义HTTP标头 [英] Is it possible to set custom HTTP headers in the WebView

查看:114
本文介绍了是否有可能在web视图设置自定义HTTP标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我就必须在我的应用程序访问一个网页,并且为了能够访问它,我需要设置一些自定义HTTP标头。我想使用的WebView 类在我的活动,但是,据我所知,这是不可能的设置自定义HTTP标头。

I have to access a web page from within my application and, in order to have access to it, I need to set some custom HTTP headers. I want to use the WebViewclass in my activity but, as far as I can tell, it's not possible to set custom HTTP headers.

那么,有没有利用现有的网络浏览器(或的WebView )的自定义HTTP标头的方法吗?我的应用程序面向Android 1.6的。

So is there a way of using the existing web browser (or WebView) with custom HTTP headers? My application targets Android 1.6.

不知道如何解决,这是极大的AP preciated。

Any idea how to solve this is greatly appreciated.

谢谢!

推荐答案

<打击>您需要获取自己的页面(例如,通过的HttpClient ),并加载它到的WebView 的方式。

You would need to fetch the page yourself (e.g., via HttpClient) and load it into the WebView that way.

请参阅海涛的回答其他地方这页。

这篇关于是否有可能在web视图设置自定义HTTP标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆