Start WhatsApp from URL HREF with custom text/content

白昼怎懂夜的黑 提交于 2019-11-30 01:53:33

whatsapp now officially support url scheme over Android(Yey)!

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

for more details visit http://www.whatsapp.com/faq/en/android/28000012

Was working on the same Problem and found the solution:

href="intent://send/[countrycode_without_plus][number]#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end

With a telephonenumber(+49 123 456 78)

href="intent://send/4912345678#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end

I think the answer you where looking for is this:

<a href="whatsapp://send?text=my message&phone=+XXXXXXXXXXX&abid=+XXXXXXXXXXX">Whatsapp me please</a>

This code works both in Android and iOS thanks to the parameters "phone" and "abid" respectively.

Sorry for the late response, hope it helps somebody anyway.

Whatsapp url scheme working only saved ids or numbers for jump message send screen. Android working with message activity for new phone numbers.

This script Looking phone os and create link for phone os.

        $(document).ready(function () {

              if (matchMedia) {
                  var mq = window.matchMedia("(max-width: 991px)");
                  mq.addListener(WidthChange);
                  WidthChange(mq);
              }

              function WidthChange(mq) {
                  var isMobile = {
                      Android: function () {
                          return navigator.userAgent.match(/Android/i);
                      },
                      BlackBerry: function () {
                          return navigator.userAgent.match(/BlackBerry/i);
                      },
                      iOS: function () {
                          return navigator.userAgent.match(/iPhone|iPad|iPod/i);
                      },
                      Opera: function () {
                          return navigator.userAgent.match(/Opera Mini/i);
                      },
                      Windows: function () {
                          return navigator.userAgent.match(/IEMobile/i);
                      },
                      any: function () {
                          return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
                      }
                  };




                  if (mq.matches) {
                      if (isMobile.Android()) {
                          $("a").attr("href", "intent://send/+905055555#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end");
                      } else {
                          $("a").attr("href", "tel:+905555555555");

                      }
                  };

              }
          });
Ronierison
href="intent://send/4912345678#Intent;
scheme=smsto;
package=com.whatsapp;
action=android.intent.action.SENDTO;end

This will not work with iPhones.

Hiren Modi

I used this href="intent://send/4912345678#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end

but in this code cant include the text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!