question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Catch 302 redirect on onNavigationStateChange method on Android

See original GitHub issue

Bug description: On Android I’m not catch url with 302 status on onNavigationStateChange method. On iOS it’s work is good.

To Reproduce: Expo Snack example

Expected behavior: Get https://httpstat.us/302 on logs then I use Android.

Screenshots/Videos: 2019-10-08 17 22 11

Environment:

  • OS: Android
  • OS version: 9
  • react-native version: 0.59.9
  • react-native-webview version: 5.12.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

4reactions
awatt-coxcommented, Dec 2, 2019

I’m having this same issue. on iOS, I see the 302 redirect happening in onNavigationStateChange(), so my custom code can catch the original url (before the redirect) and respond. in Android, I never see the 302:

iOS onNavigationStateChange:

  • url 1 is seen by Webview
  • 302 redirect happens
  • url 2 is seen by Webview

Android onNavigationStateChange:

  • url 1 is NOT seen by Webview, so I can’t perform any custom actions
  • 302 redirect happens
  • url 2 IS Seen by Webview

React Native version = 0.61.2 React native Webview version = 7.4.0

0reactions
cokealmonacidcommented, May 28, 2021

Exact same issue here, even adding the networkSecurityConfig to the Androidmanifest Any solution on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Catch 302 redirect on onNavigationStateChange method on ...
Bug description: On Android I'm not catch url with 302 status on onNavigationStateChange method. On iOS it's work is good.
Read more >
How to prevent redirecting when using react-native-webview ...
Is it possible way to do this? In IOS, using stopLoading works fine but it is not working on Android, onNavigationStateChanged(navState) { if( ......
Read more >
How to handle navigation with WebViews in a React Native app
Using the prop onNavigationStateChange that represents the navigation state of the component, you just need to pass the current URL and keep track...
Read more >
onNavigationStateChange of WebView on android get url with ...
Changing source to uri from url was my fix. This was only happening to me on Android, onNavigationStateChange was returning url "about:blank". Cheers:...
Read more >
Diff - 316b880c55..1b93c87e38 - chromium/src - Git at Google
+ +package org.chromium.android_webview; + +import android.content. ... bool visible) {} + + // Behavior of this function matches that of + ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found