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

Browser tab auto-closing right after calling Browser.open() #2095

Open
Alekey1919 opened this issue Apr 30, 2024 · 2 comments
Open

Browser tab auto-closing right after calling Browser.open() #2095

Alekey1919 opened this issue Apr 30, 2024 · 2 comments

Comments

@Alekey1919
Copy link

Alekey1919 commented Apr 30, 2024

Bug Report

Opening a new browser after arriving at the app through a deep link causes it to auto-close or crash.

Plugin(s)

"@capacitor/browser": "^6.0.0"
(Although I tried downgrading and the problem persisted)

Capacitor Version

  Capacitor Doctor   

Latest Dependencies:

  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0

Installed Dependencies:

  @capacitor/android: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/cli: 6.0.0
  @capacitor/ios: 6.0.0

[success] Android looking great! 👌
[error] Xcode is not installed

Platform(s)

Android 14

Current Behavior

In our app, users need to go to the browser to register and that works fine, the issue is that after registering they go back to the app and the browser closes as expected, but when we trigger another Browser.open() inside the app the tab opens and closes immediately.

Expected Behavior

The browser should stay opened until closed by the user.

Code Reproduction

const handleRedirect = async () => {
    await Browser.open({
      url: '...',
      windowName: '_self',
      presentationStyle: 'popover',
    })
  }

useEffect(() => {
  handleRedirect()
}, [])

Other Technical Details

Opening a new browser alone works fine, but doing so after arriving at the app through a deep link doesn’t. Also, I'm not calling Browser.close() anywhere in the code.

Additional Context

The only workaround I found so that the browser doesn't close automatically was to call Browser.open() inside a setTimeout with at least 1500ms, and even with that it's still not consistent.

@IT-MikeS
Copy link
Contributor

For your reproduction please include a sample app repo that can be tested against

@Ionitron
Copy link
Collaborator

This issue needs more information before it can be addressed.
In particular, the reporter needs to provide a minimal sample app that demonstrates the issue.
If no sample app is provided within 15 days, the issue will be closed.

Please see the Contributing Guide for how to create a Sample App.

Thanks!
Ionitron 💙

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

No branches or pull requests

3 participants