Skip to content

If hostname set, cannot navigate certain app's url - it tries to open the remote one #1428

@1aerostorm

Description

@1aerostorm

Bug Report

Problem

I set preference name="hostname" value="site.com" /> and I trying to navigate

What is expected to happen?

window.location.href = 'https://site.com';

should open corresponding application URL.

And:

window.location.href = 'https://site.com/page';

should open corresponding application URL, too.

What does actually happen?

First one works, but second one doesn't. It tries to open remote URL with same host. And, it opens that URL in Cordova's webview, not in external browser...

Information

<?xml version='1.0' encoding='utf-8'?>
<widget id="gls.messenger" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Hello World</name>
    <description>Sample Apache Cordova App</description>
    <author email="dev@cordova.apache.org" href="https://cordova.apache.org">
        Apache Cordova Team
    </author>
    <content src="/" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <preference name="hostname" value="site.com" />
</widget>

Command or Code

See above.

Environment, Platform, Device

Android.

Version information

cordova 11.0.0
cordova-android 10.1.2

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions