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

bug: external link opens in webview instead of browser #5786

Closed
umeshn1 opened this issue Jul 23, 2022 · 5 comments · Fixed by #5913
Closed

bug: external link opens in webview instead of browser #5786

umeshn1 opened this issue Jul 23, 2022 · 5 comments · Fixed by #5913
Labels
platform: android type: bug A confirmed bug report

Comments

@umeshn1
Copy link

umeshn1 commented Jul 23, 2022

Bug Report

Capacitor Version

Capacitor Doctor   

Latest Dependencies:       

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

Installed Dependencies:    

  @capacitor/ios: not installed
  @capacitor/cli: 3.6.0        
  @capacitor/core: 3.6.0       
  @capacitor/android: 3.6.0    

[success] Android looking great! 👌

Platform(s)

Tested on Android, not sure about IOS

Current Behavior

Any link that contains the hostname specified in capacitor.config.json opens in webview instead of external browser.
Same behaviour with window.open and window.location

capacitor.config.json

"server": {
    "hostname": "example.com",
    "androidScheme": "https"
  },
studio64_xVqAh1VN6I.mp4

Code Reproduction

https://github.com/umeshn1/external-link-bug
npm run build && npx cap sync && npx cap open android

@umeshn1 umeshn1 changed the title bug: link opens in webview instead of external browser bug: external link opens in webview instead of browser Jul 23, 2022
@jcesarmobile jcesarmobile added type: bug A confirmed bug report and removed platform: ios labels Jul 25, 2022
@albgen
Copy link

albgen commented Sep 1, 2022

I think is by design to work like this so basically is not a bug but a feature :)
Let me explain; The scope of the hostname field is to test your app in live reload execution. This means that whatever url put you there, it will simulate the app meaning will show in the webview so no browser will be open as it does not make sense. If you leave that to localhost, than the example.com will be opened in the browser as you are expecting...

@jcesarmobile
Copy link
Member

This is a confirmed bug.
The hostname is not used for live reload, for live reload you use the url field.
Also the problem is the url containing the hostname, not loading the actual hostname url, in the example the problem is the app navigating to google while the hostname is example.com

@albgen
Copy link

albgen commented Sep 2, 2022

Hostname can be anything, even example.com so you cannot prohibit that.

@jcesarmobile
Copy link
Member

Yeah, you are right about that, but the issue has nothing to do with what you are talking about.
The issue is about the page navigating to google.com, not about navigating to example.com.

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: android type: bug A confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants