How to send a URL request as 'Referer'

后端 未结 1 1641
故里飘歌
故里飘歌 2021-01-22 00:19

I have an app which existed as an iPhone app first and now as an Android app. One of the functions is to load a web page which bypasses the security login by passing a string as

相关标签:
1条回答
  • 2021-01-22 00:33

    Use loadUrl() with additionalHttpHeaders parameter. It is available since Android 2.2.

    Map<String, String> extraHeaders = new HashMap<String, String>();
    extraHeaders.put("Referer", "http://www.example.com");
    
    WebView wv = (WebView) findViewById(R.id.webview);
    wv.loadUrl("http://google.com", extraHeaders);
    
    0 讨论(0)
提交回复
热议问题