1

The problem is that Android and iOS have different schemes URL.

For Android:

<a href="whatsapp://send?text=Hello%20World!">Hello, world!</a>

For iOS - Objective-C

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%20World!"];
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
    [[UIApplication sharedApplication] openURL: whatsappURL];
}

I define the type of device as follows:

<?php
$iPod    = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone  = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad    = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");
if( $iPod || $iPhone || $iPad ) {
    // ???
} else if( $Android ) {
   echo '<a href="whatsapp://send?text=Hello%20World!">Hello, world!</a>';
}
?>

Tell me how to use the code shown in the documentation Objective-C, if the site uses php and javascript (jquery)? Thanks!

llgruff
  • 69
  • 2
  • 10

0 Answers0