Skip to content

Instantly share code, notes, and snippets.

@jnrbsn
Created September 14, 2010 00:48
Show Gist options
  • Save jnrbsn/578341 to your computer and use it in GitHub Desktop.
Save jnrbsn/578341 to your computer and use it in GitHub Desktop.
Bit.ly + Twitter bookmarklet using pure JavaScript
javascript:(function(){var%20s=document.createElement('script'),l=location.href;s.type='text/javascript';s.src='http://bit.ly/javascript-api.js?version=latest&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07';s.onload=function(){BitlyCB.f=function(d){location.href='http://twitter.com/home?status='+encodeURIComponent(document.title+'%20'+d.results[l]['shortUrl'])};BitlyClient.shorten(l,'BitlyCB.f')};document.body.appendChild(s)})()
@csu
Copy link

csu commented Oct 24, 2015

Refused to load the script 'http://bit.ly/javascript-api.js?version=latest&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07' because it violates the following Content Security Policy directive: "script-src assets-cdn.github.com".

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