android - Will there be multiple http requests when opening an http page?
世界只因有你
世界只因有你 2017-05-16 13:26:42
0
3
678

When I use webview, I open a page, and then if there is a 404 error, the error page is displayed.
During the use, I found that when I opened a page, a total of 7 requests were made, including 2 requests. The resource returned 404, which caused the page to be loaded, but an error interface was still displayed.

So I would like to ask, is there not only one network request when opening an http page? (Wouldn’t it only return 200 once, or 404 or something else)?

世界只因有你
世界只因有你

reply all(3)
刘奇

There will be many times, including
Document: html file itself
Resources: Image Video js file css file
Data: ajax request
etc

Browser F12 will see clearly

过去多啦不再A梦

A page includes many parts. If your page contains images, style files, data pulled from the backend, etc. It won’t be requested once, but many times.

洪涛

Generally, webview determines whether the loading failure is mainly to determine whether the HTML document part is 200. After the HTML is loaded, there are many places that need to be loaded asynchronously, such as obtaining css, js, pictures and other data. By rewriting onLoadResource, you can see what has been loaded. resource. As for displaying the error page, you also need to look at the server settings. Some servers will redirect you to the specified page for errors such as 404 and 502, instead of the error page that comes with the webview. This kind of page is generally It's a problem on the server side and has nothing to do with whether the machine responds to the page correctly.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!