• 我正在使用Angular Web应用程序
  • 我正在尝试在Facebook上分享我的内容
  • 当我尝试共享Facebook弹出窗口时,我得到了
    消息 href应该代表一个有效的URL
  • 我想分享诸如
  • 之类的内容



    代码

    html
     <a href="#" (click)="fb($event)"><img src="assets/imgs/fb.svg"/></a>
    

    ts
    fb(e) {
        let url = 'www.google.com';
        e.preventDefault();
        var facebookWindow = window.open(
          'https://www.facebook.com/sharer/sharer.php?u='+ 'Use Referral code ->' + this.userData.referCode + '   to join the newest fantasy sports platform' +  url + '. Earn extra points along with lots of exciting prizes. Don’t delay, join the match today! url',
          'facebook-popup',
          'height=350,width=600'
        );
        if (facebookWindow.focus) {
          facebookWindow.focus();
        }
        return false;
      }
    

    最佳答案

    请在您的 index.html 文件中添加元标记

    标记示例

    例如,以下是使用og:type =“article”和其他几个属性标记文章,新闻报道或博客文章的方法:

    <meta property="og:url"                content="http://www.nytimes.com/2015/02/19/arts/international/when-great-minds-dont-think-alike.html" />
    <meta property="og:type"               content="article" />
    <meta property="og:title"              content="When Great Minds Don’t Think Alike" />
    <meta property="og:description"        content="How much does culture influence creative thinking?" />
    <meta property="og:image"              content="http://static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/19iht-btnumbers19A-facebookJumbo-v2.jpg" />
    

    关于javascript - Angular应用程序中的Facebook分享,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55215128/

    10-12 01:32