简体   繁体   English

像按钮不显示(jsfiddle除外)

[英]Like button not showing (except jsfiddle)

My problem is, that the like button is not showing, when I try to run it local. 我的问题是,当我尝试在本地运行该按钮时,like按钮没有显示。 On JSfiddle it works, I don't understand why. 在JSfiddle上它有效,我不明白为什么。

JSFiddle: http://jsfiddle.net/fmzu6738/ JSFiddle: http : //jsfiddle.net/fmzu6738/

With the code I want to achieve, if I click the like button, I like the page and the page automatically redirect to the facebook side 使用我要实现的代码,如果单击“喜欢”按钮,则我喜欢该页面,并且该页面会自动重定向到facebook端

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
<head>
    <title>bla</title>
</head>
<body>
    <div id="Div1">
    </div>
    <script type="text/javascript">
        (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) { return; }
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
            fjs.parentNode.insertBefore(js, fjs);
        } (document, 'script', 'facebook-jssdk'));</script>

        <div id="fb-root">
        </div>
        <fb:like href="https://www.facebook.com/Bxyz" send="true" show_faces="false" data-layout="button" data-action="like" data-show-faces="false" data-share="false">
        </fb:like>
        <script src="http://connect.facebook.net/en_US/all.js"></script>
        <script>
            FB.init({
                status: true, // check login status
                cookie: true, // enable cookies to allow the server to access the session
                xfbml: true  // parse XFBML
            });
        </script>
        <script type="text/javascript">

            FB.Event.subscribe('edge.create', window.location.href = "https://www.facebook.com/xyz";);

        </script>

</body>
</html>

What is wrong here? 怎么了 Thank you very much! 非常感谢你!

Facebook api需要HTTP服务器(例如“ apache,IIS等”),以确保您正在使用本地服务器(例如“ xammp,apache,mamp for mac”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM