How to detect the Facebook like button in JavaScript?
-
I am attempting to detect the facebook like button in a chrome content script written in javascript. I've tried many methods including: var fbXML = document.getElementsByTagName('fb:like'); for (var i=0;i<fbXML.length;i++). { alert("found something"); fbXML[i].parentNode.removeChild(fbXML[i]); } Generally the code for a fb like button is as follows: (sorry its so messy, it was only way it would copy) The "fb:like" tag is unique. <div class="cnnFBRecBtn" id="cnnStryRcmndBtn"> // not unique <fb:like action="recommend" show_faces="true" layout="standard" href="http://www.cnn.com/2011/TECH/mobile/07/18/iphone.skydive/index.html" width="336" class=" fb_edge_widget_with_comment fb_iframe_widget"><span> <iframe id="f11b5e9de8" name="f1c0c5bab4" scrolling="no" style="border-width: initial; border-color: initial; overflow-x: hidden; overflow-y: hidden; height: 28px; width: 336px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " title="Like this content on Facebook." class="fb_ltr" src="http://www.facebook.com/plugins/like.php?action=recommend&api_key=64b385429f05b2492d713f343d05ba02&channel_url=http%3A%2F%2Fstatic.ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%3Fversion%3D3%23cb%3Df3286dfc94%26origin%3Dhttp%253A%252F%252Fwww.cnn.com%252Ff2ccd0007c%26relation%3Dparent.parent%26transport%3Dpostmessage&href=http%3A%2F%2Fwww.cnn.com%2F2011%2FTECH%2Fmobile%2F07%2F18%2Fiphone.skydive%2Findex.html&layout=standard&locale=en_US&node_type=link&sdk=joey&show_faces=true&width=336"></iframe></span></fb:like></div>
-
Answer:
Get some facebook likes .js files from http://userscripts.org & extract what you need.
Rajanshu Ujjwal at Quora Visit the source
Related Q & A:
- How To Detect Online Facebook User?Best solution by Stack Overflow
- How To Detect Who Is Online In Facebook?Best solution by Stack Overflow
- How to detect Android in JavaScript?Best solution by Stack Overflow
- How to implement your own like button in Android?Best solution by Stack Overflow
- How to detect only if back button is pressed?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.