Android용 모바일 웹 사이트(응용프로그램 아님)에서 WhatsApp의 공유 링크
저는 휴대폰에 주로 사용되는 웹사이트를 개발했습니다.
웹 페이지에서 왓츠앱으로 바로 정보를 공유할 수 있도록 하고 싶습니다.
사용자 에이전트 탐지를 사용하면 안드로이드와 iOS를 구분할 수 있습니다.
의 내용을 는 iOS해 URL다를 할 수 할 수 .
href="whatsapp://send?text=http://www.example.com"
OS가 Android일 때 사용할 솔루션을 계속 찾고 있습니다(위의 내용이 작동하지 않기 때문입니다).
안드로이드에서 "intent"를 사용하는 것과 다소 관련이 있는 것 같은데 href의 파라미터로 사용하는 방법을 알 수가 없었습니다.
방금 웹사이트에서 봤는데 최신 크롬과 왓츠앱으로 최신 안드로이드에서도 작동하는 것 같습니다!링크를 다시 시도해 보세요!
<a href="whatsapp://send?text=The text to share!" data-action="share/whatsapp/share">Share via Whatsapp</a>
오늘(2015년 4월 17일th) 다시 확인:
iOS 8 (아이폰6, 최신버전) Android 5 (Nexus 5, 최신버전)에서 작동합니다.
윈도우 폰에서도 작동합니다.
위의 답변들은 좀 구식입니다.이러한 메서드는 사용할 수 있지만 아래 메서드를 사용하면 텍스트를 미리 정의된 숫자에 공유할 수 있습니다.아래 방법은 안드로이드, 왓츠앱 웹, IOS 등에 적용 가능합니다.
다음 형식만 사용하면 됩니다.
<a href="https://api.whatsapp.com/send?phone=whatsappphonenumber&text=urlencodedtext"></a>
업데이트 -- 지금부터 사용(Nov-2018)
<a href="https://wa.me/whatsappphonenumber/?text=urlencodedtext"></a>
사용처: https://wa.me/15551234567
사용 안 함: https://wa.me/+001-(555)1234567
대화의 텍스트 필드에 자동으로 나타나는 미리 채워진 메시지로 자신만의 링크를 만들려면 https://wa.me/whatsappphonenumber/ ?text= urlencoded text를 사용합니다. whatsapp 전화번호는 국제 형식의 전체 전화 번호이고 URL로 인코딩된 텍스트는 URL로 인코딩된 미리 채워진 메시지입니다.
예: https://wa.me/15551234567?text=I'm%20interested%20in%20your%20car%20for%20sale
미리 채워진 메시지만으로 링크를 만들려면 https://wa.me/ ?text= urlencoded text를 사용합니다.
예: https://wa.me/ ?text=%20 문의 중 %20%에 대해%20 아파트%20 목록
링크를 클릭하면 메시지를 보낼 수 있는 연락처 목록이 나타납니다.
자세한 정보는 https://www.whatsapp.com/faq/en/general/26000030 을 참조하십시오.
현재 이를 달성하는 것은 매우 쉬운 일입니다.페이지에 다음 코드만 추가하면 됩니다.
<a href="whatsapp://send?text=<<HERE GOES THE URL ENCODED TEXT YOU WANT TO SHARE>>" data-action="share/whatsapp/share">Share via Whatsapp</a>
그리고 이것이 마지막입니다.자바스크립트는 필요 없고, 다른 것은 필요 없습니다.물론 원하는 대로 스타일링 할 수 있고 멋진 왓츠앱 아이콘도 포함할 수 있습니다.
구글 크롬으로 안드로이드 기기에서 테스트해봤습니다.버전:
- 안드로이드 4.1.2 (젤리빈)
- 크롬 모바일 37.0.2062.117Firefox Mobile 31.0에서도 테스트되었습니다.
- 왓츠앱 V 2.11.399
iOS에서도 작동합니다.사파리가 있는 아이폰5에서 빠른 테스트를 해봤는데 작동이 됩니다.
누군가에게 도움이 되길 바랍니다. :-)
새 문서에 따르면 링크는 다음과 같습니다.
<a href="https://wa.me/?text=urlencodedtext">Share this</a>
안 되면 이 방법을 사용해 보세요.
<a href="whatsapp://send?text=urlencodedtext">Share this</a>
공식 문서에는 다음과 같이 쓰여 있습니다.wa.me
. 사용하지않습니다.wa.me
것에 이런 결과가 나온 것에 대해서는 사과의 말씀을 드리지만, 이 문제는 급속도로 발전하는 문제였습니다.
2020년 4월 실적
링크가 올바르지 않습니다.이 창을 닫고 다른 링크를 시도합니다.
2020년 5월 실적
링크 GitHub 티켓 공유:전화번호가 없는 WhatsApp 짧은 링크가 더 이상 작동하지 않습니다.
찾으시는 페이지를 찾을 수 없습니다.
존재하지 않는 페이지를 찾고 있는 것 같습니다.아니면 방금 삭제했을 수도 있는 페이지.어느 쪽이든 다시 돌아가거나 URL과 철자를 확인한 후 다시 시도하십시오.
2020년 8월 실적
역시 잘 되네요!
최신 - 2020년 10월 결과
부러졌다 (!)
og:image
할 때 됩니다.wa.me
.
있는 의견들로 봤을 때, 이 는 여전히 인 것 를 합니다, . 그러니 앞으로 계속 진행하는 것을 추천합니다.api.whatsapp.com
URL!
공유하려면 다음 두 가지 URL 형식 중 하나를 반드시 사용해야 합니다.
https://api.whatsapp.com/send?text=YourShareTextHere
https://api.whatsapp.com/send?text=YourShareTextHere&phone=123
이러한 URL을 추적하는 프로젝트를 보고 싶다면 다음을 확인해 보십시오!:https://github.com/bradvin/social-share-urls#whatsapp
최근 WhatsApp은 공식 웹사이트에서 이 HTML 태그를 사용하여 모바일 사이트에 공유할 수 있도록 해야 한다고 업데이트했습니다.
<a href="whatsapp://send?text=Hello%20World!">Hello, world!</a>
합니다.text=
것.
최신 업데이트
왓츠앱 API 를에서 할 수 .https://wa.me/
사용자 에이전트에 대한 걱정 없이 API가 사용자 에이전트 처리를 수행합니다.
해당 왓츠앱 클라이언트(Android / iOS / Webapp)에서 연락처 선택 옵션으로 미리 채워진 텍스트 공유:
https://wa.me/?text=urlencodedtext
Open Chat Dialog for a particular whatsapp user in respective whatsapp client (Android / iOS / Webapp):
https://wa.me/whatsappphonenumber
Share pre-filled text with a particular user (Combine above two):
https://wa.me/whatsappphonenumber/?text=urlencodedtext
참고:whatsappphonenumber
국제 형식의 전체 전화 번호여야 합니다.국제 형식으로 전화 번호를 추가할 때 0, 대괄호 또는 대시를 생략합니다.
For official documentation visit https://faq.whatsapp.com/en/general/26000030
I'm afraid that WhatsApp for Android does not currently support to be called from a web browser.
I had the same requirement for my current project, and since I couldn't find any proper information I ended up downloading the APK file.
In Android, if an application wants to be called from a web browser, it needs to define an Activity with the category android.intent.category.BROWSABLE.
You can find more information about this here: https://developers.google.com/chrome/mobile/docs/intents
If you take a look to the WhatsApp AndroidManifest.xml file, the only Activiy with category BROWSABLE is this one:
<activity android:name="com.whatsapp.Conversation" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:windowSoftInputMode="stateUnchanged">
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
</activity>
I've been playing with it for a while, and I couldn't make it to work. The most I got was to open the WhatsApp application from Chrome, but I couldn't figure out a way to set the message content and recipient.
Since it is not documented by the WhatsApp team, I think this is still work in progress. It looks like in the future WhatsApp will handle SMS too.
The only way to get more information is by reaching the WhatsApp dev team, what I tried, but I'm still waiting for a response.
Regards!
In general it makes sense only to display the Whatsapp Link on iOS or Android Devices only, using java script:
if (navigator.userAgent.match(/iPhone|Android/i)) {
document.write('<a href="whatsapp://send?text=See..">Share on WhatApp</a>');
}
방금 테스트를 해봤습니다.whatsapp://
나의 상전에 대한 계략.Android 2.3.3
와 함께Whats App 2.11.301
, 매력적으로 작용합니다.그것은 단지 그.Whats App
버전부터Whats App
모두에게 업데이트를 강요하는 것입니다. 안전하게 사용할 수 있어야 합니다.
그Whats App
문서에서도 이 체계에 대해 언급하고 있습니다. http://www.whatsapp.com/faq/en/android/28000012
I'm using this on a production site now and will update here, if I get any user complaints.
Edit (Nov 14): No user complaints after a couple of weeks.
데스크톱이든 모바일이든 플랫폼에 따라 whatsapp 공유 링크를 전환합니다.
이것은 링크에 전화번호를 제공하든 제공하지 않든 간에 작동합니다.
모바일용
vm.LinkTextToShare = 'https://api.whatsapp.com/send?text=' + encodeURIComponent(window.location.href) ;
window.open(vm.LinkTextToShare,"_blank");
데스크톱용
vm.LinkTextToShare = 'https://web.whatsapp.com/send?l=en&text=' + encodeURIComponent(window.location.href) ;
window.open(vm.LinkTextToShare,"_blank");
이 코드가 저한테 통했어요.
링크를 클릭하면 메시지를 공유할 연락처를 선택하라는 메시지가 나타납니다.
<a href="https://api.whatsapp.com/send?text=enter message here">Click here to share on Whatsapp</a>
target="_blank" 특성을 추가하여 새 창이나 탭에서 열 수 있습니다.
특정 메시지나 기사를 공유하고 싶을 때는 전화번호가 필요 없다고 생각합니다.
" whatsapp://send?text=" + 인코딩처럼 사용합니다.UI 구성 요소(텍스트가 여기에 표시됨)는 반드시 작동합니다.
브라우저에서 whatsapp을 열려는 경우 이는 옳습니다.
<a href=`https://web.whatsapp.com/send?text=${yout URL or TEXT}` ><Whatsapp</a>
사용처: https://wa.me/1XXXXXXXXXX
사용 안 함: https://wa.me/+001-(XXX)XXXXXXX
미리 채워진 메시지가 대화의 텍스트 필드에 자동으로 나타납니다.whatsapp 전화번호는 국제 형식의 전체 전화번호이고 urlencoded text는 URL로 인코딩된 미리 채워진 메시지인 https://wa.me/whatsappphonenumber?text=urlencodedtext 를 사용합니다.
예: https://wa.me/1XXXXXXXXXX?text=I'm%20interested%20in%20your%20car%20for%20sale
미리 채워진 메시지만으로 링크를 만들려면 https://wa.me/ ?text= urlencoded text를 사용합니다.
링크를 클릭하면 메시지를 보낼 수 있는 연락처 목록이 나타납니다.
이런 식으로 해보세요.
<a href="https://wa.me/(phone)?text=(text URL encoded)">Link</a>
링크에 전화번호를 입력하지 않아도 메시지를 보낼 수 있습니다.
<a href="https://wa.me/?text=Hello%20world!">Say hello</a>
링크를 클릭하면 메시지를 보낼 수 있는 연락처 목록이 나타납니다.
자세한 내용은 https://faq.whatsapp.com/en/general/26000030 에서 확인할 수 있습니다.
행운을 빕니다.
언급URL : https://stackoverflow.com/questions/21935149/sharing-link-on-whatsapp-from-mobile-website-not-application-for-android
'programing' 카테고리의 다른 글
PDO에서 LIKE 쿼리 구현 (0) | 2023.10.04 |
---|---|
zip 파일 생성/추출 및 기존 파일/내용 덮어쓰기 (0) | 2023.09.24 |
GOobject System은 왜 만들어졌습니까? (0) | 2023.09.24 |
XSD - 어떤 순서로든 요소를 몇 번이든 허용하는 방법? (0) | 2023.09.24 |
신호R 2.0 오류: 파일 또는 어셈블리 Microsoft를 로드할 수 없습니다.오윈.보안 (0) | 2023.09.24 |