WebView redirects into iFrame on Android
See original GitHub issueBug description:
WebView Component redirects into iFrame(s) when serving from static resources on Android. Used props are:
{
source: {uri: 'file://<path/to/index.html>'}
originWhitelist: ['*'],
allowFileAccess: true
}
However it was working correctly on v.2.10.0. And here is a fork of working version that we’re stuck to use in our original app in order to get the right behavior.
To Reproduce: Here is the repo of an example app to reproduce error. You can download and examine the source code that i’m using in the example app
Expected behavior: WebView shouldn’t redirect into Iframe src on Android. The view in the iOS Simulator is expected.
Screenshots/Videos: Screenshots produced at latest version of react-native-webView (5.8.1) Android: (incorrect) iOS: (correct)
Environment:
- OS: macOS Mojave
- OS version: 10.14.4
- react-native version: 0.59.5
- react-native-webview version: > 2.10.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:11
Top Results From Across the Web
WebView redirects into iFrame on Android · Issue #560 - GitHub
WebView Component redirects into iFrame(s) when serving from static resources on Android. ... However it was working correctly on v.2.10.0. And ...
Read more >Android WebView, how to handle redirects in app instead of ...
So right now in my app the URL I'm accessing has a redirect, and when this happens the WebView will open a new...
Read more >Intercept all requests in WebView on Android | by Andy Wang
I have a requirement that all HTTP requests from a WebView on Android need to be handled locally. For example, providing assets for...
Read more >WebView - Android's most convenient footgun - byte.how
Exploring iframe security through an Android WebView lens. ... On click, a link redirects the top frame to a malicious page.
Read more >Managing WebView objects - Android Developers
Android provides several APIs to help you manage the WebView objects that display web content in your app. This page describes how to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
We might have found a fix for this. 😃 It seems that the iOS version contains a check preventing unwanted redirects of the main frame. The Android version doesn’t check this.
The following change to
RNCWebViewManager.java
adding the main frame check seems to fix the issue: