It will grab a preview image from opengraph or favicon unless you specify one through a method that changes the title in the description to the name of the image file with dropdown (undesirable).
This also includes a share icon from FontAwesome.
const shareLinkBtn = document.getElementById('share-link-btn');
shareLinkBtn.addEventListener('click', async () => {
try {
const url = document.location.href;;
const share = await navigator.share({
title: document.title,
text: "text doesn't work with the current API but it is req in the spec so we include it here, leave empty double parentheses",
url: document.location.href,
});
console.log('Shared successfully:');
} catch (error) {
console.error('Error sharing content:', error);
}
});