Skip to content

Commit

Permalink
Fix: Let WhatsApp handle wa.me links instead of opening them in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed Feb 8, 2025
1 parent 3472093 commit 0211d61
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "altus",
"productName": "Altus",
"version": "5.5.0",
"version": "5.5.1",
"description": "Desktop client for WhatsApp Web with themes & multiple account support.",
"main": ".vite/build/main.js",
"build": {
Expand Down
6 changes: 6 additions & 0 deletions src/whatsapp.preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@ window.onload = () => {

document.body.addEventListener("click", (event) => {
if (!(event.target instanceof HTMLAnchorElement)) return;
console.log(event.target);
if (
event.target.tagName === "A" &&
event.target.getAttribute("target") === "_blank"
) {
const url = new URL(event.target.href);
if (url.hostname === "wa.me" || url.hostname === "api.whatsapp.com") {
// WhatsApp automatically opens the correct chat for "click to chat" links.
return;
}
ipcRenderer.send("open-link", event.target.href);
}
});
Expand Down

0 comments on commit 0211d61

Please sign in to comment.