-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathsocialsharing.html
35 lines (29 loc) · 1.22 KB
/
socialsharing.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript">
$( document ).ready(function() {
const shareData = {
title: 'LatinChain Platform',
text: 'Hi. Check it out this Pi App: LatinChain Platform (Pi Network Games from Latin America). Try it in Pi Browser. #PiNetwork #PiApps',
url: 'https://latin-chain.com/',
}
if (!navigator.share) {
$("#social_div").html("Browser can't share");
}else
{
const btn = document.querySelector('#button1');
//const resultPara = document.querySelector('.result');
// Must be triggered some kind of "user activation"
btn.addEventListener('click', async () => {
try {
await navigator.share(shareData);
//resultPara.textContent = 'MDN shared successfully'
} catch(err) {
//alert('Error: ' + err);
}
});
}
});
</script>
<div id="social_div">Share in Social Networks:<br/><br/>
<button id="button1"class="btn btn-primary">Share</button><br/><br/>
</div>