开发者

Cant get "like" button to work on my website

开发者 https://www.devze.com 2023-04-12 13:03 出处:网络
We have tried everything and can\'t get this to work. We have offically given up. Here is the code we have been using:

We have tried everything and can't get this to work. We have offically given up. Here is the code we have been using:

<div id="fb-root"></div>

<script>
    (function(d) {
        var js, id = 'facebook-jssdk';
        if (d.getElementById(id)) { return; }
        js = d.createElement('script');
        js.id = id;
        js.async = true;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
        d.getElementsByTagName('head')[0].appendChild(js);
    }(document));
</script>

<div class="fb-lik开发者_JAVA技巧e-box" 
    datahref="https://www.facebook.com/pages/Athens-Dental-Center/104463542954148"
    data-width="292"
    data-show-faces="false"
    data-stream="false"
    data-header="false">
</div>

Now, here is the problem: this is exactly what we see on the website; no like button, just the code. How might I resolve this?


datahref should be data-href instead. HTML code is HTML code and there's nothing that could break this. Be sure there are no &lt; & &gt; in your code

EDIT:

Your code looks like

<span class="tag"><font color="#800000">&lt;div</font></span><span class="pln"> </span><span class="atn"><font color="#ff0000">id</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"fb-root"</font></span><span class="tag"><font color="#800000">&gt;&lt;/div&gt;</font></span><span class="pln">&#160;<br />

        &#160;<br />

        </span><span class="tag"><font color="#800000">&lt;script&gt;</font></span><span class="pln">&#160;<br />

        &#160; &#160; </span><span class="pun">(</span><span class="kwd"><font color="#00008b">function</font></span><span class="pun">(</span><span class="pln">d</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">&#160;<br />

        &#160; &#160; &#160; &#160; </span><span class="kwd"><font color="#00008b">var</font></span><span class="pln"> js</span><span class="pun">,</span><span class="pln"> id </span><span class="pun">=</span><span class="pln"> </span><span class="str"><font color="#800000">'facebook-jssdk'</font></span><span class="pun">;</span><span class="pln">&#160;<br />

        &#160; &#160; &#160; &#160; </span><span class="kwd"><font color="#00008b">if</font></span><span class="pln"> </span><span class="pun">(</span><span class="pln">d</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="pln">id</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd"><font color="#00008b">return</font></span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln">&#160;<br />

        &#160; &#160; &#160; &#160; js </span><span class="pun">=</span><span class="pln"> d</span><span class="pun">.</span><span class="pln">createElement</span><span class="pun">(</span><span class="str"><font color="#800000">'script'</font></span><span class="pun">);</span><span class="pln">&#160;<br />

        &#160; &#160; &#160; &#160; js</span><span class="pun">.</span><span class="pln">id </span><span class="pun">=</span><span class="pln"> id</span><span class="pun">;</span><span class="pln">&#160;<br />

        &#160; &#160; &#160; &#160; js</span><span class="pun">.</span><span class="pln">async </span><span class="pun">=</span><span class="pln"> </span><span class="kwd"><font color="#00008b">true</font></span><span class="pun">;</span><span class="pln">&#160;<br />

        &#160; &#160; &#160; &#160; js</span><span class="pun">.</span><span class="pln">src </span><span class="pun">=</span><span class="pln"> </span><span class="str"><font color="#800000">"//connect.facebook.net/en_US/all.js#xfbml=1"</font></span><span class="pun">;</span><span class="pln">&#160;<br />

        &#160; &#160; &#160; &#160; d</span><span class="pun">.</span><span class="pln">getElementsByTagName</span><span class="pun">(</span><span class="str"><font color="#800000">'head'</font></span><span class="pun">)[</span><span class="lit"><font color="#800000">0</font></span><span class="pun">].</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">js</span><span class="pun">);</span><span class="pln">&#160;<br />

        &#160; &#160; </span><span class="pun">}(</span><span class="pln">document</span><span class="pun">));</span><span class="pln">&#160;<br />

        </span><span class="tag"><font color="#800000">&lt;/script&gt;</font></span><span class="pln">&#160;<br />

        &#160;<br />

        </span><span class="tag"><font color="#800000">&lt;div</font></span><span class="pln"> </span><span class="atn"><font color="#ff0000">class</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"fb-like-box"</font></span><span class="pln"> &#160;<br />

        &#160; &#160; </span><span class="atn"><font color="#ff0000">data-href</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"https://www.facebook.com/pages/Athens-Dental-Center/104463542954148"</font></span><span class="pln">&#160;<br />

        &#160; &#160; </span><span class="atn"><font color="#ff0000">data-width</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"292"</font></span><span class="pln">&#160;<br />

        &#160; &#160; </span><span class="atn"><font color="#ff0000">data-show-faces</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"false"</font></span><span class="pln">&#160;<br />

        &#160; &#160; </span><span class="atn"><font color="#ff0000">data-stream</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"false"</font></span><span class="pln">&#160;<br />

        &#160; &#160; </span><span class="atn"><font color="#ff0000">data-header</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"false"</font></span><span class="tag"><font color="#800000">&gt;</font></span><span class="pln">&#160;<br />

        </span><span class="tag"><font color="#800000">&lt;/div&gt;</font></span><span class="pln">&#160;<br />

        </span></strong></em></font></font></font></font></span></font></td>

so you're probably using some code beautifier or another function which colorize your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消