Opening phone dialer

I'm having trouble opening phone dialer from my retool mobile app, i tried this code but nothing works

const icon8 = document.getElementById('icon8');


icon8.addEventListener('click', () => {
  openPhoneDialer();
});


function openPhoneDialer() {
  const phoneNumber = "123-456-7890";
  const dialerUrl = `tel:${phoneNumber}`;

  window.location.href = dialerUrl;
}

Any help would be much apppreciated.

@Kabirdas

The js in retool is run in sandbox environment, so maybe you can visit location of window. You can only use API retool offered to do that.

Or you can use html a element? <a href="tel:555-123-4567">dialer</a>

there is no html component in retool mobile
@AnsonHwang

Finally got it to work. I just created an onclick event handler for the call icon and then for the action: open url. In the url field I just put in tel: 2123434545 and it worked just fine.

2 Likes