1

I have read this Question and I also have searched on google to get the total number of social media share button's counts but I realize that this is not an easy task especially for Google+ and also if you have multiple buttons for multiple links on a Single Page.

So I'm trying achieve this by using a different approach via jQuery. Link...

enter image description here

I want to get and calculate the total number of shares as text number inside the count box and I have read that jQuery .contents() can access iframe HTML elements, So I want to select the the iframe that generated by the share buttons and select the count's element id and get the total numbers of shares inside a <div>????</div> tag on my webpage. But still no Success...

Please help me to do this & Here is the sample JSFiddle - JSFiddle

Any help would be much appreciated. Thank you! & BTW I'm a beginner & using ASP.NET WebMatrix.

[Edited]

I really need a proper and useful solution to achieve this.

Community
  • 1
  • 1
Anonymous
  • 10,002
  • 3
  • 23
  • 39

1 Answers1

4

Why don't you just use the API's it would be a whole lot quicker rather than using jQuery's content.

eg http://urls.api.twitter.com/1/urls/count.json?url=http://www.google.co.uk

returns the number of times that url has been shared etc

{"count":92127,"url":"http:\/\/www.google.co.uk\/"}

Facebook and Google have their own api's which you can also check the counts on.

Tom Maton
  • 1,564
  • 3
  • 23
  • 41
  • What about getting the total and place it inside the `
    ????
    ` tag and have multiple buttons for multiple links on a Single Page? & I'm a beginner and I think it's too complex:)
    – Anonymous Aug 04 '14 at 12:59
  • 2
    Yes but @MaryMelody ... We are not here to do your job for you. We are here to help you solve small problems you encounter while working it out for yourself. – BenjaminPaul Aug 04 '14 at 13:44
  • 1
    it should be noted (in case you find this) that the urls.api.twitter.com no longer works I found this searching for how do I find the google+ count in an API, saw the twitter one and tried it... dead. oh well – julian guppy Dec 05 '15 at 15:24