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); } 

https://jsfiddle.net/7ny07lfw/19/


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -