0

I have a whatsapp share button that shares the current URL (using window.location)

waCurrentPage = function() {
return encodeURI("whatsapp://send?text=Lets go here: " + 'http://' + window.location.hostname + window.location.pathname + window.location.search);
}

Button

<a class="btn btn-social-icon btn-whatsapp" href="javascript:window.location=waCurrentPage();">Whatsapp share this list</a> 

I can see that from the browser side it's sending the correct URL...

enter image description here

...but when it gets to the whatsapp side it has cut off the second parameter

enter image description here

Anyone have an idea how I could fix it?

user1180888
  • 497
  • 1
  • 10
  • 29
  • 1
    Does this answer your question? [whatsapp://send?text cut string from '&' character till end?](https://stackoverflow.com/questions/37318772/whatsapp-sendtext-cut-string-from-character-till-end) – wuerfelfreak Apr 11 '21 at 16:58
  • Thanks, that's definitely closer. That just adds the whatsapp URL to the end of my domain URL and tries to refresh the page, meaning I get a 404 error. – user1180888 Apr 11 '21 at 19:14
  • 1
    Only use the encodeURIComponent on the part from "Lets..." to the end, so that you don't double encode the `whatsapp://` – wuerfelfreak Apr 11 '21 at 19:22

0 Answers0