Passing Headers while using Browser Intent

后端 未结 2 1659
孤独总比滥情好
孤独总比滥情好 2021-02-13 16:37

I want to pass some headers while opening a web page. Right now, I\'m doing something like : browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse(data.link)); startActi

2条回答
  •  情深已故
    2021-02-13 17:33

    This was my biggest question in the last 2days, too! And I found it!!!

    I have a Map object that I stored header information. Then the following:

    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    Bundle bundle = new Bundle();
    if(mExtraHeader!=null){
     for(String key: mExtraHeader.keySet()){
      bundle.putString(key, mExtraHeader.get(key));
     }
    }
    i.putExtra(Browser.EXTRA_HEADERS, bundle);
    startActivity(i);
    

    One problem is...I guess this would only work with the default browser and other browsers wouldn't have Browser.EXTRA_HEADERS I suppose. Resource: http://gitorious.org/rowboat/packages-apps-browser/blobs/a563d09392905140893d7a017dd63721577e1953/src/com/android/browser/BrowserActivity.java

提交回复
热议问题