Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
QR Code Bookmarklet
javascript:(function(window, document, undefined) {try {var selectedText = document.getSelection().toString(); if (selectedText === ''){selectedText = window.location.href;} if(selectedText !== ''){var baseQRUrl = '' + encodeURIComponent(selectedText);, '_blank', 'width=400,height=400');}} catch (e) {}})(window, document);
//Opens a window with a QR code for either selected text on the page or the current page URL if no text is selected.
//Bookmarklet-ify it by removing whitespace and prepending javascript:
//Like so: javascript:(function ....)()
(function(window, document, undefined) {
try {
var selectedText = document.getSelection().toString();
if (selectedText === '') {
selectedText = window.location.href;
if (selectedText !== '') {
var baseQRUrl = '' + encodeURIComponent(selectedText);, '_blank', 'width=400,height=400');
} catch (e) {
})(window, document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.