Location Redirect of SMS, Email, or Call not working on Page Load in ReactJS

Viewed 38

I'm using the following code snippet:

 else if (item.title == 'Text') {
            try {
                window.open(`//sms:${item.link}`, "_blank")
            } catch (error) {
                console.log(error)
            }

When clicking on a button on the page, it works perfectly, triggering the SMS app, and the correct number being prefilled. But if I want this to execute on a page load, it just opens a blank page with sms:12345 (just an example) on a new tab but does not trigger the phone SMS app.

I'm facing this issue on React.

0 Answers
Related