Passing Headers while using Browser Intent

后端 未结 2 1696
孤独总比滥情好
孤独总比滥情好 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:27

    As Satoshi guessed, this doesn't work with Chrome. If you need to pass headers, you'll need to create your own WebView and load the url with a map of headers. Assume that mWebView is a reference to your webview.

    Map headers = new HashMap<>();
    headers.put("referer", "http://some-referer");
    mWebView.loadUrl(mUrl, headers);
    

提交回复
热议问题