Skip to content

Instantly share code, notes, and snippets.

@dougalcampbell
Last active April 8, 2019 20:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougalcampbell/1950560 to your computer and use it in GitHub Desktop.
Save dougalcampbell/1950560 to your computer and use it in GitHub Desktop.
OpenGraph Bookmarklet
javascript:$=jQuery;if(0!==$("#myogdiv").length)$("#myogdiv").hide().remove();else{var%20myogdiv=$('<div%20id="myogdiv"/>');$("body").append(myogdiv);$('head%20meta[property^="og:"],head%20meta[property^="fb:"],head%20meta[name^="twitter:"]').each(function(d,b){var%20a=$(b).attr("property"),c=$(b).attr("content");void%200==a&&(a=$(b).attr("name"));$(myogdiv).append("<div><b>"+a+":</b>"+c+"</div>");"og:image"==a&&$(myogdiv).append('<br/><img%20src="'+c+'"%20style="max-width:250px"/>');"twitter:image"==a&&$(myogdiv).append('<br/><img%20src="'+c+'"%20style="max-width:250px"/>')});$(myogdiv).css("position","absolute").css("top","0").css("zIndex",9999999).css("padding","0.5em").css("border","1px%20solid%20red").css("backgroundColor","white")}void%200;
@dougalcampbell
Copy link
Author

Updated to support Twitter Card info.

Note: depends on jQuery. If jQuery isn't already on the page, use the jQuerify Bookmarklet: http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment