Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(iOS): Fix iframes in iOS/WKWebview which were broken by #418. Fixes #424. #425

Merged
merged 1 commit into from
Feb 11, 2019

Conversation

dpa99c
Copy link
Contributor

@dpa99c dpa99c commented Feb 11, 2019

Platforms affected

iOS

Motivation and Context

This fixes iframes in WKWebView implementation for iOS which was broken by PR #418 in its attempt to fix issue #417.

#418 tried to solve the issue of page links with target=_blank not working by redirecting any request which was not targeted at the main frame back to the main frame, based on https://stackoverflow.com/a/25853806/777265.

While this fixed links where target=_blank, it also had the unintended side effect of redirecting iframe requests, causing the target URL to be loaded into the main frame.

Description

This PR fixes that by only redirecting requests that don't have a target frame set, i.e. those with a "new window action" aka target=_blank.
This based on https://stackoverflow.com/a/25713070/777265.

Testing

The changes have been tested with page links that contain target=_blank (e.g. https://dpa99c.github.io/cordova-plugin-inappbrowser-test/iab_content/iab.html) and with pages that use iframes (e.g. https://www.trivago.com) to ensure both still work.

There are currently no automated tests that cover this functionality specifically.

Checklist

  • [ x] I've run the tests to see all new and existing tests pass
  • [x ] I added automated test coverage as appropriate for this change
  • [x ] Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • [x ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • [x ] I've updated the documentation if necessary

@purplecabbage
Copy link
Contributor

lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants