Category : share

I have a website that has some articles that I’d like to share on LinkedIn. I’m using the following code to make that happen: HTML on the article page: <a href="" target="_blank" class="js_linkedin-share">Share on LinkedIn</a> JavaScript that loads on the article page: let shareUrl = window.location.href; document.querySelector(‘.js_linkedin-share’).setAttribute(‘href’, ‘https://www.linkedin.com/sharing/share-offsite/?url=’+shareUrl); When the page loads, it should set ..

Read more

I have this script but its only share from mobile version. $(document).ready(function() { $(document).on("click", ‘.mc_whatsapp_btn’, function() { if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { var text = $(this).attr("data-text"); var url = $(this).attr("data-link"); var message = encodeURIComponent(text) + " – " + encodeURIComponent(url); var whatsapp_url = ".whatsapp://send?text=" + message; window.location.href = whatsapp_url; } else { alert("Please use an Mobile ..

Read more

I’m using this script linked to a button to share a page on facebook. The problem is that I open Facebook via browser, is there a solution to open the Facebook application installed on the ios / android phone? <script> document.getElementById(‘shareBtn’).onclick = function() { FB.ui({ method: ‘share’, display: ‘popup’, href: ‘https://developers.facebook.com/docs/’, }, function(response){}); } </script> ..

Read more

I am trying to make a button to share a image and text. And I found this code from mdn. if(navigator.canShare && navigator.canShare({files: filesArray})){ navigator.share({ files: filesArray, title: ‘Pictures’, text: ‘Our Pictures.’, }) .then(() => console.log(‘Share was successful.’)) .catch((error) => console.log(‘Sharing failed’, error)); } else { console.log(`Your system doesn’t support sharing files.`); } But I ..

Read more