是否有可能在web视图设置自定义HTTP标头有可能、自定义、视图、HTTP

2023-09-04 11:08:16 作者:精致小猪

我就必须在我的应用程序访问一个网页,并且为了能够访问它,我需要设置一些自定义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.

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