Closed akshgods closed 2 days ago
@akshgods can you check issue is reproducible on latest version?
@netmaxt3r yes confirmed with latest available version.
code to test:
<WebView source={{ uri: '3Ca%20_blank%20href=https://reactnative.dev/' }}
style={{ flex: 1 }}
onError={(e) => {
console.log('onError:: ', e);
}}
onHttpError={(e) => {
console.log('onHttpError:: ', e);
}}
renderError={(e) => {
console.log('renderError:: ', e);
}}
/>
Environment:
OS: Mac OS version: 13.2.1 (22D68) "react-native": "0.73.6", "react-native-webview": "^13.8.5"
I am getting different results.
on iOS its just console.warn with Error opening URL: [Error: Unable to open URL: ....
on Android it does call onError
with nativeEvent
{"canGoBack": false, "canGoForward": false, "code": -2, "description": "net::ERR_NAME_NOT_RESOLVED", "loading": false, "target": 3, "title": "", "url": "http://3ca%20_blank%20href%3Dhttps//reactnative.dev/"}
followed by two calls to renderError
with null error
In either case app does not crash
@netmaxt3r but im getting same error as i sent before.
but im not getting warning , can you share your code and url used?
also send react native version and plugin version used
@netmaxt3r i understand you code diffrence
you used http:// in starting of url
just use this without http:
source={{ uri: '3Ca%20_blank%20href=https://reactnative.dev/' }}
@akshgods i havent added http protocol, it is added by android as the url is malformed it cannot detect the protocol, where as in ios it defaults to file
protocol to relative path as seen in the warning
return (
<WebView source={{ uri: '3Ca%20_blank%20href=https://reactnative.dev/' }}
style={{ flex: 1 }}
onError={(e) => {
console.log('onError:: ', e.nativeEvent);
}}
onHttpError={(e) => {
console.log('onHttpError:: ', e);
}}
renderError={(e) => {
console.log('renderError:: ', e);
}}
/>
);
"dependencies": {
"react": "18.2.0",
"react-native": "0.73.6",
"react-native-webview": "^13.8.5"
}
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically
Bug description:
If we pass invalid url we are getting crash
actual url: https://www.hindustantimes.com/ht-img/img/2024/03/27/550x309/Akshay_Kumar_1711524357605_1711524357751.jpg
invalid url which causing crash: '%3Ca%20_blank%20href=https://www.hindustantimes.com/ht-img/img/2024/03/27/550x309/Akshay_Kumar_1711524357605_1711524357751.jpg'
Error handling functions not returning anything.
To Reproduce:
Reproduce is simple, just use this url in your webview url:
url={'%3Ca%20_blank%20href=https://www.hindustantimes.com/ht-img/img/2024/03/27/550x309/Akshay_Kumar_1711524357605_1711524357751.jpg'}
now open webview you will get application getting crash.
Expected behavior:
it should not get crashed , it will throw error in one of error handling function.
let me know what changes required or what we can do it to solved this?
Environment: