Skip to content

Instantly share code, notes, and snippets.

@jphase
Last active March 24, 2016 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jphase/3274d351d8e4dac691ba to your computer and use it in GitHub Desktop.
Save jphase/3274d351d8e4dac691ba to your computer and use it in GitHub Desktop.
Clear Facebook Cached Images on Current URL (Bookmarklet)
javascript: (function() {
var jquery = document.createElement('script');
jquery.setAttribute('src', 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js');
document.body.appendChild(jquery);
jQuery.post( 'https://graph.facebook.com', {
id: window.location.href,
scrape: true
}, function(response) {
if ( typeof response == 'object' && response.hasOwnProperty('url') && response.hasOwnProperty('image') ) {
var msg = 'Successfully cleared ' + response.image.length + ' cached image' + (response.image.length > 1 ? 's' : '') + ' from Facebook:' + "\n\n";
response.image.forEach(function(value, index, array) {
msg += value.url + "\n";
});
alert(msg);
} else {
alert("No cached Facebook images found at:\n\n" + window.location.href);
}
console.log(response);
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment