OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Web Share</title> |
| 5 <script> |
| 6 function initiate_share() { |
| 7 if (navigator.share === undefined) { |
| 8 window.document.title = 'Fail: navigator.share === undefined
'; |
| 9 return; |
| 10 } |
| 11 |
| 12 var data = {title: "Test Title", text: "Test Text", |
| 13 url: "https://test.url"}; |
| 14 navigator.share(data).then(() => { |
| 15 window.document.title = 'Success'; |
| 16 }).catch(e => { |
| 17 window.document.title = 'Fail: ' + e; |
| 18 }); |
| 19 } |
| 20 |
| 21 window.addEventListener('load', () => { |
| 22 window.addEventListener('click', initiate_share); |
| 23 }); |
| 24 </script> |
| 25 </head> |
| 26 <body> |
| 27 </body> |
| 28 </html> |
OLD | NEW |