Untitled
9 months ago in Plain Text
<!DOCTYPE html>
<html>
<head>
<title>Compartilhar Página no WhatsApp</title>
</head>
<body>
<a id="compartilhar-whatsapp" href="javascript:void(0);" onclick="shareOnWhatsApp()">Compartilhar no WhatsApp</a>
<script>
// Função para obter a URL da página atual
function getCurrentURL() {
return window.location.href;
}
// Função para compartilhar no WhatsApp
function shareOnWhatsApp() {
var currentURL = getCurrentURL();
var whatsappURL = "https://api.whatsapp.com/send?text=" + encodeURIComponent(currentURL);
window.open(whatsappURL, '_blank');
}
</script>
</body>
</html>