i developing chrome extension show alert when user clicks on facebook button.
i'm using jquery purpose it's not working.
here code
$("button").click(function(){ alert("like"); });
i tried code, button inside iframe still no luck!
var abc = $(document).find('iframe:first').contents().find('html:first').find('body:first'); abc.find("button").click(function(){ alert("like"); });
manifest.json (i added permissions file)
"permissions": [ "tabs", "http://*/*", "https://*/*", "http://*.facebook.com/", "https://*.facebook.com/" ]
any appreciated??
well first problem might fact in cases, 'like' <a>
not button, $('button')
not select it. detecting like
link being clicked needed:
manifest.json
"permissions": [ "tabs","*://*.facebook.com/*" ], "content_scripts": [{ "matches": ["*://*.facebook.com/*"], "js": ["jquery.js","click.js"] }]
click.js
// of likes on things such comments , pictures , $('a.ufilikelink').click(function(){ console.log('like link clicked somewhere'); }); // 'button' can found on pages $('input[value="like"]').click(function(){ console.log('like button clicked somewhere'); });
Comments
Post a Comment