html - Whatsapp: Un able to share current link with Javascript -
i trying share current link in whatsapp using following javascript , html
<script language="javascript">     function wacurrentpage(){         return "whatsapp://send?text=check out: "+'http://' +         window.location.hostname + window.location.pathname;    } </script>   <a  class="btn btn-social-icon btn-whatsapp" href="javascript:wacurrentpage()"      data-action="share/whatsapp/share"><i class="fa fa-whatsapp"></i> </a> i have have no idea why not working getting output in browser after pressing button:
whatsapp://send?text=check out: http://bggressive.nl/test/index.html
try this:
<a class="btn btn-social-icon btn-whatsapp" href="javascript:window.location=wacurrentpage();">link</a> js:
wacurrentpage = function() {    return encodeuri("whatsapp://send?text=check out: " + 'http://' + window.location.hostname + window.location.pathname); } 
Comments
Post a Comment