티스토리 뷰

반응형

Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.

Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.

 

아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.

Sharing link on WhatsApp from mobile website (not application) for Android

안드로이드 모바일 웹사이트(어플리케이션이 아닌)에서 WhatsApp으로 링크 공유하기

 문제 내용 

I have developed a website which is mainly used in mobile phones.
I want to allow users to share information directly from the web page into WhatsApp.

저는 모바일 기기에서 주로 사용하는 웹사이트를 개발했습니다. 사용자들이 웹 페이지에서 정보를 직접 WhatsApp으로 공유할 수 있도록 허용하고 싶습니다.

 

Using UserAgent detection I can distinguish between Android and iOS.
I was able to discover that in order to implement the above in iOS I can use the URL:

UserAgent 검출을 사용하여 Android와 iOS를 구분할 수 있습니다. iOS에서 위의 내용을 구현하려면 URL을 사용할 수 있다는 것을 발견했습니다.
href="whatsapp://send?text=http://www.example.com"

 

I'm still looking for the solution to be used when the OS is Android (as the above doesn't work).
I guess it is somehow related to using "intent" in Android, but I couldn't figure out how to do it as parameter for href.

OS가 Android인 경우에 대한 해결책을 아직 찾고 있습니다 (위의 해결책은 작동하지 않습니다). Android에서는 "intent"를 사용하는 것과 관련이 있는 것 같지만 href의 매개변수로 어떻게 사용해야 하는지 이해하지 못했습니다.

 

 

 

 높은 점수를 받은 Solution 

Just saw it on a website and seems to work on latest Android with latest chrome and whatsapp now too! Give the link a new shot!

웹사이트에서 방금 확인했는데, 최신 버전의 안드로이드와 크롬, 그리고 WhatsApp에서도 작동하는 것 같아! 링크를 다시 시도해 보세요!
<a href="whatsapp://send?text=The text to share!" data-action="share/whatsapp/share">Share via Whatsapp</a>

 

Rechecked it today (17th April 2015):
Works for me on iOS 8 (iPhone 6, latest versions) Android 5 (Nexus 5, latest versions).

오늘 다시 확인해 봤습니다 (2015년 4월 17일): 제 iPhone 6 (최신 버전)과 Nexus 5 (최신 버전)에서 작동합니다.

 

It also works on Windows Phone.

Windows Phone에서도 작동합니다.

 

 

 

 가장 최근 달린 Solution 

This code worked for me.

이 코드는 제대로 작동했습니다.

 

After clicking on the link, it will ask you to choose the contact to share a message.

링크를 클릭하면, 메시지를 공유할 연락처를 선택하도록 요청합니다.

 

<a href="https://api.whatsapp.com/send?text=enter message here">Click here to share on Whatsapp</a>

 

You can add target="_blank" attribute to open it in a new window or tab.

"target="_blank" 속성을 추가하여 새 창이나 탭에서 열 수 있습니다."

 

I don't think the phone number is needed when someone wants to share a particular message or article.

특정 메시지나 글을 공유할 때는 전화번호가 필요하지 않다고 생각합니다.

 

 

 

출처 : https://stackoverflow.com/questions/21935149/sharing-link-on-whatsapp-from-mobile-website-not-application-for-android

반응형
댓글
공지사항
최근에 올라온 글