Reputation: 11
I want to open WhatsApp automatically with HTML redirect. Using the api.whatsapp it opens a page where the user has to click "Send" or "Message", my idea is to skip this step using something like "whatsapp://send". Is it possible? How?
This code will open whatsapp:
<a href="whatsapp://send?phone=0000000000&text=example">**App**</a></p>
But the user needs to click in the "App" Button, I want it to redirect automatically with a link (ex mydomain.com/redirectwpp)
<meta http-equiv='refresh' content='0; URL=https://api.whatsapp.com/send?phone=XXXXXXXXX'>
This is the code I'm using on my page, it will redirect automatically but this doesn't send then direct to the WhatsApp.
Upvotes: 1
Views: 9744
Reputation: 1
You can use this link; it will redirect you to WhatsApp chat with the message. Take care to put the correct phone number, including the correct country code.
<a href="https://wa.me/+0000000000?text=MESSAGE" target="_blank"></a>
Upvotes: 0
Reputation: 403
You can place the redirect script at the head in your webpage so once the user is into your domain it will redirect to the WhatsApp
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Whatsapp Redirect</title>
<script>
window.location.replace("whatsapp://send/?phone=0000000&text=example" );
</script>
</head>
<body>
</body>
</html>
This will redirect the user to WhatsApp once he is in your domain
note: User needs to accept the browser permission prompt for successful redirection
Upvotes: 0
Reputation: 858
This is simply not possible, it is not secure for user if the browser and OS skip the middle step unless the users does it once and give the permission to the browser and OS to do the same always. And this is not related to HTML or JS or anything in the webpage, the middle step must be there for security reasons.
Upvotes: 1