How to open phone number in phone application on Android from webview?

I have TMA (Telegram Mini Application), on the seller details block I have a button using which the user can make a call by seller number.

Problem: When the user clicks on the phone number button to call a seller automatically opens the phone app without the already entered phone number.

My current working solution for IOS:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>const handleCall = () => {
const phoneNumber = detailUserInfo.phone.trim().replace(/D/g, '');
if (phoneNumber) window.open(`tel:+${phoneNumber}`);
else console.error('Invalid phone number');
};
<Button onClick={handleCall} size='large' variant='primary'>
Make a call
</Button>
</code>
<code>const handleCall = () => { const phoneNumber = detailUserInfo.phone.trim().replace(/D/g, ''); if (phoneNumber) window.open(`tel:+${phoneNumber}`); else console.error('Invalid phone number'); }; <Button onClick={handleCall} size='large' variant='primary'> Make a call </Button> </code>
const handleCall = () => {
  const phoneNumber = detailUserInfo.phone.trim().replace(/D/g, '');
  if (phoneNumber) window.open(`tel:+${phoneNumber}`);
  else console.error('Invalid phone number');
};

<Button onClick={handleCall} size='large' variant='primary'>
   Make a call
</Button>

Unfortunately, this solution doesn’t work on Android (actually it opens the phone app without already entering the phone number).

I’ve already tried solutions like these:

Encoding phone number (doesn’t work on any OS)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>const handleCallDefault = () => {
const phoneNumber = detailUserInfo.phone.trim().replace(/D/g, '');
if (phoneNumber) {
const formattedNumber = `+${phoneNumber}`;
const encodedNumber = encodeURIComponent(formattedNumber);
window.open(`tel:${encodedNumber}`, '_blank', '_system');
} else {
console.error('Invalid phone number');
}
};
</code>
<code>const handleCallDefault = () => { const phoneNumber = detailUserInfo.phone.trim().replace(/D/g, ''); if (phoneNumber) { const formattedNumber = `+${phoneNumber}`; const encodedNumber = encodeURIComponent(formattedNumber); window.open(`tel:${encodedNumber}`, '_blank', '_system'); } else { console.error('Invalid phone number'); } }; </code>
const handleCallDefault = () => {
  const phoneNumber = detailUserInfo.phone.trim().replace(/D/g, '');

  if (phoneNumber) {
    const formattedNumber = `+${phoneNumber}`;
    const encodedNumber = encodeURIComponent(formattedNumber);

    window.open(`tel:${encodedNumber}`, '_blank', '_system');
  } else {
    console.error('Invalid phone number');
  }
};

Object window.location.hef

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>const handleCallUtilsWindowLocation = () => {
const phoneNumber = detailUserInfo.phone.trim().replace(/D/g, '');
if (phoneNumber) {
const formattedNumber = `+${phoneNumber}`;
const encodedNumber = encodeURIComponent(formattedNumber);
window.location.href = `tel:${encodedNumber}`;
} else {
console.error('Invalid phone number');
}
};
</code>
<code>const handleCallUtilsWindowLocation = () => { const phoneNumber = detailUserInfo.phone.trim().replace(/D/g, ''); if (phoneNumber) { const formattedNumber = `+${phoneNumber}`; const encodedNumber = encodeURIComponent(formattedNumber); window.location.href = `tel:${encodedNumber}`; } else { console.error('Invalid phone number'); } }; </code>
const handleCallUtilsWindowLocation = () => {
  const phoneNumber = detailUserInfo.phone.trim().replace(/D/g, '');

  if (phoneNumber) {
    const formattedNumber = `+${phoneNumber}`;
    const encodedNumber = encodeURIComponent(formattedNumber);

    window.location.href = `tel:${encodedNumber}`;
  } else {
    console.error('Invalid phone number');
  }
};

Next.js Link component (works for IOS)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><Link href={`tel:+${detailUserInfo.phone}`} target='_blank'>
Make a call
</Link>
</code>
<code><Link href={`tel:+${detailUserInfo.phone}`} target='_blank'> Make a call </Link> </code>
<Link href={`tel:+${detailUserInfo.phone}`} target='_blank'>
  Make a call
</Link>

Anchor tag <a href>

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><a href={`tel:+${detailUserInfo.phone}`} target='_blank'>
Make a call
</Link>
</code>
<code><a href={`tel:+${detailUserInfo.phone}`} target='_blank'> Make a call </Link> </code>
<a href={`tel:+${detailUserInfo.phone}`} target='_blank'>
  Make a call
</Link>

Any of this options doesn’t works correctly in Telegram webview, but it works in browser.
Thanks in advance for any recommendation

It was already solved in the latest Telegram Mini App update.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật