-->
当前位置:首页 > articles > 正文内容

Luz1个月前 (10-28)articles250

Web Share API - link and text does not appear on social media

  • Vladimir Kyatipov 问题:
    • async function share() {  const imageQuote = '<?=$image_quote; ?>';  const response = await fetch(imageQuote);  const blob = await response.blob();  let pageTitle = 'THe Page';  let pageText  = document.getElementsByClassName("quote")[0].innerText;  let pageUrl   = window.location.href;       const filesArray = [    new File(      [blob],      'panion.jpg',      {        type: blob.type,        lastModified: new Date().getTime()      }   )  ];  const shareData = {    title: pageTitle,    text: pageText,    url: pageUrl,    files: filesArray,};  if (navigator.share) {  navigator    .share(shareData)    .then(() => console.log("Successful share"))    .catch((error) => console.log("Error sharing", error));} else {  console.error("Browser doesn't support Web Share API");}    console.log(shareData);}    function shareThisQuote() {    return share();}
  • 回答:
返回列表

上一篇:

下一篇:

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。