Skip to content

Instantly share code, notes, and snippets.

@blairanderson
Created September 26, 2017 23:34
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 blairanderson/369ccbf49fa8b718ff84300ac6484704 to your computer and use it in GitHub Desktop.
Save blairanderson/369ccbf49fa8b718ff84300ac6484704 to your computer and use it in GitHub Desktop.
basic javascript bookmarklet
javascript: var d = document,
w = window,
e = w.getSelection,
k = d.getSelection,
x = d.selection,
s = e ? e() : k ? k() : x ? x.createRange().text : 0,
f = 'http://awesomewebsite.com/bookmarklet/iframe',
l = d.location,
e = encodeURIComponent,
u = f + '?u=' + e(l.href) + '&t=' + e(d.title) + '&s=' + e(s) + '&v=4';
a = function() {
if (
!w.open(
u,
't',
'toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570'
)
)
l.href = u;
};
if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0);
else a();
void 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment