How to send a URL request as 'Referer'

后端 未结 1 1664
故里飘歌
故里飘歌 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 extraHeaders = new HashMap();
    extraHeaders.put("Referer", "http://www.example.com");
    
    WebView wv = (WebView) findViewById(R.id.webview);
    wv.loadUrl("http://google.com", extraHeaders);
    

    0 讨论(0)
提交回复
热议问题