How to send a referer request in a url for a webView

后端 未结 2 1697
渐次进展
渐次进展 2020-12-06 07:00

I need to display a web page in my Android app which is looking for a referer to bypass the security. I\'m new to Android so I know how to display the web page in a web view

2条回答
  •  悲哀的现实
    2020-12-06 07:30

    You will need to use Intent Filters to capture and modify WebView requests.

    Assuming that you need to specify doamin.com/page.html as referrer

    1. Setup intent filters to capture all http requests in WebView
    2. If request is for "doamin.com/page.html", return pre-defined page that has a refresh tag to send user to "http://www.mywebsite.com"
    3. domain.com/page.html would be sent as a referrer to mywebsite.com

    In newer APIs you can specify headers in loadUrl itself.

提交回复
热议问题