[PR #98] fix: open links with target=_blank in CustomTabs, same behavior as chrome PWAs #222

Open
opened 2026-10-29 12:17:10 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/cylonid/NativeAlphaForAndroid/pull/98
Author: @chaserhkj
Created: 1/19/2023
Status: 🔄 Open

Base: dev ← Head: custom-tab-fix


📝 Commits (1)

  • ad54a7b Fix target=_blank behavior

📊 Changes

2 files changed (+24 additions, -0 deletions)

View changed files

📝 app/build.gradle (+1 -0)
📝 app/src/main/java/com/cylonid/nativealpha/WebViewActivity.java (+23 -0)

📄 Description

In a chrome-created PWA on Android, if the user clicks a link with target=_blank (requesting link to be opened in a new tab), the link will be opened in a newly-popped-up browser activity (CustomTabs) , instead of navigating the main app page to the link or opening it in system browser.

This behavior is particularly important for SPAs like a music player, where the user could be listening to some music and browsing around, and opening links in new tab as requested can have the music playback uninterrupted.

However in current Native Alpha behavior such a click would make the main app page to navigate to the link and interrupt the playing music in main app page. This PR fixes this and make Native Alpha behave the same as chrome PWAs.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cylonid/NativeAlphaForAndroid/pull/98 **Author:** [@chaserhkj](https://github.com/chaserhkj) **Created:** 1/19/2023 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `custom-tab-fix` --- ### 📝 Commits (1) - [`ad54a7b`](https://github.com/cylonid/NativeAlphaForAndroid/commit/ad54a7b347580970bde62d73a0dc223a7285cb37) Fix target=_blank behavior ### 📊 Changes **2 files changed** (+24 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `app/build.gradle` (+1 -0) 📝 `app/src/main/java/com/cylonid/nativealpha/WebViewActivity.java` (+23 -0) </details> ### 📄 Description In a chrome-created PWA on Android, if the user clicks a link with `target=_blank` (requesting link to be opened in a new tab), the link will be opened in a newly-popped-up browser activity (CustomTabs) , instead of navigating the main app page to the link or opening it in system browser. This behavior is particularly important for SPAs like a music player, where the user could be listening to some music and browsing around, and opening links in new tab as requested can have the music playback uninterrupted. However in current Native Alpha behavior such a click would make the main app page to navigate to the link and interrupt the playing music in main app page. This PR fixes this and make Native Alpha behave the same as chrome PWAs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cylonid/NativeAlphaForAndroid#222
No description provided.