Acknowledged
over 1 year ago

Bug: Communications.openWebpage removes hash # from url

Using the following line of code:

            Communications.openWebPage(url, params, options);

With a var url of the form  'https://www.example.com/sub#'

And a var params of the form { param1 => 'value1' }

And a var options of the form {}

On the phone, a notification will show to open the url 'https://www.example.com/sub#', but when clicked, the url that will be in the browser is actually 'https://www.example.com/sub/?param1='value1'.

In other words, the # is removed when the url is sent to the browser (tried many browsers like Chrome, Firefox, etc, and multiple Android versions up to Android 14).

Can this be fixed? Or is there a workaround that will keep the hash in the url?

  • Thanks for your response! You are right that in the case of downloading a page to the watch, it would not matter. The # part (fragment identifier) is indeed not sent to the server.

    However, in this case I am sending the url to the phone to open it in the browser. This webpage is using the fragment in the javascript indeed, and without it, the javascript is missing information and does not work as intended.

  • This makes sense, since # is not part of the URL (it's not part of the http protocol address). If you do this in a desktop browser then you'll see that it doesn't send it to the server. The only way # is used is either to jump to an ancor or to read it by javascript. But both of these make no sense when you try to download a page to the watch