简体   繁体   English

如何捕捉 facebook 分享按钮 ID?

[英]How to catch facebook share button id?

Hey guys How can I catch facebook share button id?嘿伙计们,我怎样才能抓住 facebook 共享按钮 ID? I mean this page share button(http://www.facebook.com/sharer/sharer.php? ) Not counter share button我的意思是这个页面分享按钮(http://www.facebook.com/sharer/sharer.php?)不是反分享按钮

I use this function but it doesnt work..我使用这个 function 但它不起作用..

function fbs_click() { function fbs_click() {

                   u = location.href;
                   t = document.title;
                   neww = window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436');

                   $(neww.document).ready(function () {

                       $(".uiButtonConfirm input[name='share']").mouseover(function () {

                           alert("test");

                       });


                   });

             return false;


               }

You can't access another page like this.您无法访问这样的其他页面。 The neww window is on another domain (facebook.com) and cross-domain policies won't allow you to run javascript on this page because it is on another domain. neww window 位于另一个域 (facebook.com) 上,跨域策略不允许您在此页面上运行 javascript,因为它位于另一个域上。 This includes listening for an element in another window to be hovered over.这包括在另一个 window 中侦听要悬停的元素。

I can have a guess that what you want to do is some kind of feedback when the user shares using this sharer.php page?我可以猜到,当用户使用此共享器共享时,您想要做的是某种反馈。php 页面? If so, the only thing I can recommend is to have some kind of feedback when the user closes this share or neww window.如果是这样,我唯一可以推荐的就是在用户关闭此共享或neww window 时获得某种反馈。 You would do this by adding the following after you open the window:您可以在打开 window 后添加以下内容:

neww.onunload = function(){ 
    // Do what you want to do when the window has closed
    alert("CLOSED!!"); 
}

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

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