Page 1 of 1

Share icon

Posted: Fri Apr 19, 2024 8:24 am
by Joan Ferrer
Hello everyone
How can I create a "universal" share icon, that on a mobile you can choose from the different sharing options that the mobile offers?

Tnk's

Re: Share icon

Posted: Fri Apr 19, 2024 9:31 am
by Pablo
Maybe this?
https://www.wysiwygwebbuilder.com/suppo ... ecity.html

Or else, can you be more specific?

Re: Share icon

Posted: Fri Apr 19, 2024 9:39 am
by Joan Ferrer
Thanks for your attention.
On some websites, I have seen that they have a text, text with an image... and when you click from the smartphone, it is the smartphone that proposes several ways to share, WhatsApp, Telegram,...

On a computer, different options open.
An example is: https://bauharum.com/products/santjordineta

---> Compartir

Thank you

Re: Share icon

Posted: Fri Apr 19, 2024 11:14 am
by Pablo
I do not see any share links on this website.
But are you sure these are not standard links?

For example:
https://www.javatpoint.com/how-to-add-a ... javascript

This also works in WWB

Re: Share icon

Posted: Fri Apr 19, 2024 1:45 pm
by Joan Ferrer

Re: Share icon

Posted: Fri Apr 19, 2024 1:49 pm
by Pablo
There is no standard option for this. This requires a custom script.

Re: Share icon

Posted: Fri Apr 19, 2024 2:09 pm
by Joan Ferrer
ok ... :(

Tnk's

Re: Share icon

Posted: Fri Apr 19, 2024 6:48 pm
by miguelss
Hi,

You can add a HTML with this code:

Code: Select all

<!DOCTYPE html>
<html>
<head>
  <title>Botón de Compartir</title>
</head>
<body>

<button id="shareButton">Compartir</button>

<script>
document.addEventListener('DOMContentLoaded', function() {
  const shareButton = document.getElementById('shareButton'); // Select existing button

  shareButton.addEventListener('click', async function() {
    try {
      await navigator.share({
        title: document.title,
        text: '¡Mira esta página!',
        url: window.location.href
      });
      console.log('Contenido compartido con éxito');
    } catch (error) {
      console.error('Error al compartir:', error);
    }
  });
});
</script>

</body>
</html>
Image

Enjoy 🤗
M.

Re: Share icon

Posted: Mon May 06, 2024 4:47 pm
by Joan Ferrer
Oh, fantastic, works perfectly!
Salu2