Reputation: 409
looking for answer over a 2 months now..please help
i am using webview to create my ios app and in my mobile website there is whatsapp share button which shares content to whatsapp and it works fine on any browser, for android app i have implement code to make it work..
this is my whatsapp code in my website:
href="whatsapp://send" data-text="content goes here" data-href="" class="wa_btn wa_btn_s" style="display:none">Share
and this is what i am using in my xcode
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool { if (request.url!.scheme == "whatsapp") { let wurl = URL(string: "whatsapp://")!
if #available(iOS 10.0, *) {
UIApplication.shared.open(wurl, options: [:], completionHandler: nil)
} else { UIApplication.shared.openURL(wurl)
}
return false
}
return true
}
it opens whatsapp but there is no content if i use it like this:
string: "whatsapp://sendtext="hello world"
it shares hello world, but i want to share the content from site.
Thanks for any help
Upvotes: 1
Views: 550
Reputation: 976
You should use the following string, if you want to share a website page via Whatsapp through Mobile-Web:
whatsapp://send?text=http://www.yourwebsite.com
Using the webpage link in the text will allow Whatsapp to take the metadata from the website (icon/description..etc) and use it in the message.
Upvotes: 1