Skip to content
This repository was archived by the owner on Dec 3, 2021. It is now read-only.

Fixes status-im/status-react#1200#5

Open
RNGMonk wants to merge 1 commit into
status-im:masterfrom
RNGMonk:bug/page-opened-in-browser-instead-of-webview-#1200
Open

Fixes status-im/status-react#1200#5
RNGMonk wants to merge 1 commit into
status-im:masterfrom
RNGMonk:bug/page-opened-in-browser-instead-of-webview-#1200

Conversation

@RNGMonk
Copy link
Copy Markdown

@RNGMonk RNGMonk commented Jun 3, 2017

fixes status-im/status-legacy#1200

Summary:

Anna found that some pages (e.g. results page on google.ru) would open in Safari instead of the WebView on iOS. The cause of this was that results on google.ru have the target="_blank" attribute and WKWebView default behaviour is to open this in Safari which is a change from UIWebView.

I added an additional test case in decidePolicyForNavigationAction which intercepts requests opening in a new frame and attempts to handle it in the webview instead.

Steps to test:

  • In status-react change the react-native-webview-bridge dependency in package.json to github:occamin/react-native-webview-bridge#bug/page-opened-in-browser-instead-of-webview-#1200, clean and rebuild.
  • Open Status
  • Open console
  • @browse google.ru
  • search for "testing"
  • In found results tap on any link, e.g on wikipedia link
  • The page should open in the webview and not Safari

status: ready

Comment thread ios/RCTWKWebView.m
}
// Intercept target=_blank and other links that want to open in a new window
// and deal with them in the WebView if possible
else if (!navigationAction.targetFrame) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the actual fix, apologies for all the whitespace trimming noise.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Link is opened in system browser instead of a webview

1 participant