Detailed explanation: send HTTP header information when Android WebView loads web pages

Detailed explanation: send HTTP header information when Android WebView loads web pages

When you click a hyperlink to jump, WebView will automatically send the current address to the server as a referer. Therefore, many server-side programs control chain theft by whether to include a referer. Therefore, sometimes there may be a problem by directly entering a network address. So how to solve the problem of chain theft control, In fact, just add a referer when WebView is loaded. How to add it?

Starting from Android 2.2 (API 8), WebView has added a new interface method to facilitate us to send other HTTP header information when loading web pages.

The following is a simple demo to show how to use it.

Similarly, the above can also be applied to other HTTP header information such as useragent

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>