从与 App 不同的域在 Facebook 上分享 URL

Share URL on Facebook from different domain than App

我试图让我客户的网站在 Facebook 上分享一个与网站不同的 URL。例如:http://www.example.com has a share link on it for http://www.instagram.com

每当我尝试时,我都会收到以下错误:

Given URL is not permitted by the Application configuration: One or more of the given URLs is not permitted by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

我看不出如何更改我的应用程序设置以允许共享不同的 URL,尽管我猜这一定是可能的。

这是我的代码片段,看看是否有帮助:

        // Facebook Share
        $('#facebook-share').on('click', function(e){
            e.preventDefault();

            var url = $(this).attr('data-href');

            FB.ui({
                method: 'share',
                href: url
            }, function(response){
                if (response) {
                    console.log('Facebook post published.');
                } else {
                    console.log('Facebook post was not published.');
                }
            });
        });

进一步的研究似乎表明 Facebook Apps 无论如何只能与一个 URL 一起使用。我改变了使用 sharer.php 的方式:

        // Facebook Share
        $('.facebook-share').on('click', function(e){
            e.preventDefault();

            var url = encodeURIComponent($(this).attr('data-href'));
            var shareURL = "https://www.facebook.com/sharer/sharer.php?app_id=XXXXXXXX&sdk=joey&u="+url+"%2F&display=popup&ref=plugin&src=share_button";

            var width = 655;
            var height = 250;

            var left = (screen.width/2)-(width/2);
            var top = (screen.height/2)-(height/2);

            window.open(shareURL, 'facebookShare', 'scrollbars=1,resizable=1,width='+width+',height='+height+',left='+left+',top='+top);

        });