Facebook share button is sharing my login page instead of current page URL, title, etc

自作多情 提交于 2019-12-12 02:29:53

问题


I have added facebook share button to my webpage using this code:

<a name='fb_share' border="0">Share</a> <script type='text/javascript' src='jquery.js'> </script> <script src='http://static.ak.fbcdn.net/connect.php/js/FB.Share' type='text/javascript'> </script>

The above code shares the current webpage properly but when I included a session check at the start of the webpage where I redirect the user to the login page if valid session doesn't exist the above code always shares the login page instead of the current page. I am using PHP header function for redirect. Please advice.


回答1:


To share content from not publicly accessible page use Feed Dialog




回答2:


i use {} you can uncomment features as needed. Keep in mind all share button features where deprecated for the like / recommend button.


<div id="msg"></div>
    <script> 
            function feedthis() {
        var obj = {
          method: 'feed',
    //to: ''+tobe+''
        //link: 'https://developers.facebook.com/docs/reference/dialogs/',
        //picture: ''+pic+'',
        // name: 'Facebook Dialogs',
        //caption: 'Reference Documentation',
        //description: ''+msg+''
        };

        function callback(response) {
          document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
        }

        FB.ui(obj, callback);
      }
</script>


来源:https://stackoverflow.com/questions/9853887/facebook-share-button-is-sharing-my-login-page-instead-of-current-page-url-titl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!