R
R
Roman2015-07-04 12:42:48
Web development
Roman, 2015-07-04 12:42:48

Correct WhatsApp Share setup for iOS and Android?

I'm setting up a "Share" button on a website, the catch is that Android and iOS have different URL schemes.
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 device like this:
<?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 Objective-C code given in the documentation if the site uses php and javascript (jquery)?
Thank you!

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
A
An, 2015-07-04
@Flanker_4

not a web developer, but just like for android - the same link. Safari will do everything. Problems begin if the application is not installed by the user
Here are the "solutions" with the timer
stackoverflow.com/questions/627916/check-if-url-sc...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question