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

Custom tabs does not respect default browser #143

Closed
hjiangsu opened this issue Nov 18, 2023 · 8 comments · Fixed by #145
Closed

Custom tabs does not respect default browser #143

hjiangsu opened this issue Nov 18, 2023 · 8 comments · Fixed by #145
Assignees
Milestone

Comments

@hjiangsu
Copy link

Issue
Custom tabs prioritizes Chrome over the default browser's custom tabs. When setting a default browser with support for custom tabs (e.g., Firefox), triggering custom tabs will attempt to open the custom tab in Chrome. Only when Chrome is disabled, custom tabs will open using the default browser's custom tab.

To reproduce this issue:

  1. Install a browser that is compatible with custom tabs (Firefox)
  2. Set the default browser to the new browser
  3. Trigger custom tab to open
  4. See error

Expected result
Custom tabs should open using the system's default browser if the default browser supports custom tabs.

Notes
This seems to happen both on the latest version 1.2.1 and the latest beta 2.0.0-beta

@droibit
Copy link
Owner

droibit commented Nov 18, 2023

Hi @hjiangsu,

Thank you for reporting this issue.

Custom tabs prioritizes Chrome over the default browser's custom tabs.

This is intended behavior and not a bug. It was fixed in flutter_custom_tabs v1.1.0.

It is possible to add an option to CustomTabsOptions to prioritize the default browser.
Is this something you would like?

@hjiangsu
Copy link
Author

Thanks for clarifying the issue.

It is possible to add an option to CustomTabsOptions to prioritize the default browser.

Having the option to prioritize the default browser would be great!

@droibit
Copy link
Owner

droibit commented Nov 18, 2023

Got it!

I will add an option to CustomTabsOptions to change the priority of the browser to launch.
Please wait for the next beta release!

@droibit
Copy link
Owner

droibit commented Nov 22, 2023

Hi,

I've just published the new version flutter_custom_tabs v2.0.0-beta.1 to pub.dev.

This release includes a new option, prefersDefaultBrowser, which allows you to prioritize opening a URL in the default browser.
To use this option, simply update the plugin and add the following code to your project:

await launchUrl(
  ...,
  customTabsOptions: CustomTabsOptions(
    browser: const CustomTabsBrowserConfiguration(
      prefersDefaultBrowser: true,
    ),
  ),
);

@hjiangsu
Copy link
Author

Thank you for the update! I'll test it out when I have the chance

@micahmo
Copy link

micahmo commented Nov 22, 2023

@droibit Thank you so much for the super fast response on this issue! It'll really help us out.

Purely out of curiosity (no judgement), was there any reasoning for the intentional change to prefer Chrome?

Thanks again!

@droibit
Copy link
Owner

droibit commented Nov 23, 2023

@micahmo
Thanks for your feedback!

I originally made the decision to prioritize Chrome because at the time of development,
Custom Tabs support was relatively weak in other browsers. Even today, Chrome is the only browser that supports all Custom Tabs options (reference: Chrome Custom Tabs Browser Support).

Due to this limitation, the decision was made influtter_custom_tabs to prioritize Chrome.
However, considering the current progress in supporting Custom Tabs for browsers other than Chrome, I believe it would be a good idea to provide an option to prioritize the default browser on the device :)

@hjiangsu
Copy link
Author

Version v2.0.0-beta.1 seems to be working as expected. Thanks again!

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 a pull request may close this issue.

3 participants