'How to detect in WebView a 404 Error
I have a WebView which i set the the onError and the onLoadEnd.
The problem is that when i have a web page which returns a 404 not found error, i don't get it in the onError handler. I do get the onLoadEnd but there is no way to know that this is a 404 except the title.
Is there a way to detect that?
I was expecting that this would be handled by the onError callback.
Solution 1:[1]
With the current version of react-native-webview, code is a property on the event. Make sure your web server is indeed returning an HTTP code 404, and not just a webpage that says 404 in the title.
<WebView
source={{ uri: 'https://philihp.com/it-is-a-404' }}
onError={({ code }) => {
console.log({ code });
}}
/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Philihp Busby |

