2014-01-23 49 views
0

在Facebook上分享某些链接时(无论是编程式还是手动),JavaScript代码都显示在帖子中。当我在脸书上分享链接到网站时显示的Javascript代码

因此,我的问题更关系到如何修复我的网站,以便在发布到Facebook的链接时,JavaScript代码不会显示在Facebook上。

Forexample尝试张贴此链接: http://djuice.com.pk/discounts

You'l看到JavaScript代码(这是目前在共享页)在Facebook发布。 enter image description here

+0

最有可能的,因为页面是完全错误和警告 – slash197

回答

1

你应该设置description参数为共享按钮。例如:

FB.ui(
     { 
     method: 'feed', 
     name: 'The Facebook SDK for Javascript', 
     caption: 'Bringing Facebook to the desktop and mobile web', 
     description: (
      'A small JavaScript library that allows you to harness ' + 
      'the power of Facebook, bringing the user\'s identity, ' + 
      'social graph and distribution power to your site.' 
     ), 
     link: 'https://developers.facebook.com/docs/reference/javascript/', 
     picture: 'http://www.fbrell.com/public/f8.jpg' 
     }, 
     function(response) { 
     if (response && response.post_id) { 
      alert('Post was published.'); 
     } else { 
      alert('Post was not published.'); 
     } 
     } 
    ); 
+0

是的,但在这种情况下,说明会在我的代码进行硬编码。我确信有一些方法可以在我的html页面上添加说明,这可以通过facebook阅读。 –

+0

如果我没有弄错,在这种情况下,描述取自元描述 –

+0

奥克斯,非常感谢。 –

相关问题