开发者

How to catch facebook share button id?

开发者 https://www.devze.com 2023-03-17 06:22 出处:网络
Hey guys How can I catch facebook share button id? I mean this page share button(http://www.facebook.com/sharer/sharer.php? ) Not counter share button

Hey guys How can I catch facebook share button id? I mean this page share button(http://www.facebook.com/sharer/sharer.php? ) Not counter share button

I use this functi开发者_运维技巧on but it doesnt work..

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. This includes listening for an element in another window to be hovered over.

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? If so, the only thing I can recommend is to have some kind of feedback when the user closes this share or neww window. You would do this by adding the following after you open the window:

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

精彩评论

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