0

I'm using some JavaScript code to enable a PC user to send text to WhatsApp friends:

window.open("https://wa.me/?text=" + encodeURIComponent("Hello, world!"));

It does work, however, even if there's already a WhatsApp tab open - it opens a new one (forcing the user to reconnect to WhatsApp on a new tab).

Is there any option to use an already-open WhatsApp tab, if there is one?

Free Bud
  • 746
  • 10
  • 30
  • 1
    I think you can't because JavaScript can't check all the other tabs URLs, it would be a [great security problem](https://stackoverflow.com/q/3296416/22152755) however it's possible in [Firefox/Chrome extensions](https://stackoverflow.com/q/11114395/22152755). – Sally loves Lightning Jul 01 '23 at 14:00

1 Answers1

0

Not possible unless you're building a chrome extension. You might want to look into this Retrieving which tabs are open in Chrome?