android_xiaojian 2017-04-10 04:46 采纳率: 0%
浏览 4160
已结题

android webview修改header X-Requested-With

webview请求url的时候会在header里面增加了X-Requested-With,怎么修改这个值

  • 写回答

2条回答 默认 最新

  • qq_28514109 2017-04-10 08:55
    关注

    HashMap headers = new HashMap();

    headers.put("Referer", p.url);

    headers.put("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.6) Gecko/20100625

    Firefox/3.6.6 Greatwqs");

    headers.put("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");

    headers.put("Accept-Language","zh-cn,zh;q=0.5");

    headers.put("Host","www.yourdomain.com");

    headers.put("Accept-Charset","ISO-8859-1,utf-8;q=0.7,*;q=0.7");

    headers.put("Referer", "http://www.yourdomian.com/xxxAction.html");

    HttpRequestBase httpget = ......

    httpget.setHeaders(headers);

    评论

报告相同问题?

悬赏问题

  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波