javascript - Display number of LinkedIn shares, client-only, without authentication -


https://www.linkedin.com/countserv/count/share?url=stackoverflow.com&format=json correctly shows number of shares meteor.com (935 @ moment).

i'm trying display number in client:

$.getjson('https://www.linkedin.com/countserv/count/share?url=stackoverflow.com&format=json&callback=?', { datatype: "jsonp" }, function (data) {     alert(data.count); }); 

because of x-content-type-options: nosniff header being returned, i'm getting refuse execute script error in chrome:

refused execute script 'https://www.linkedin.com/countserv/count/share?url=http://stackoverflow.com&format=json&callback=jquery210014496755180880427_1426891580561&_=1426891580562' because mime type ('application/json') not executable, , strict mime type checking enabled.

is there workaround (aside routing request through proxy), or impossible, as case github, unless linkedin fixes issue?

this looks duplicate of post: get linkedin share count jsonp

here's answer recomended on there:

mycallback = function(data) {   alert(data.count); };  var url = "https://www.linkedin.com/countserv/count/share?url=http://stackoverflow.com&format=jsonp&callback=mycallback"; $.getscript(url); 

here's fiddle demonstrate: https://jsfiddle.net/z9u20ucm/1/


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -