Created
July 1, 2013 18:53
-
-
Save chitchcock/5903510 to your computer and use it in GitHub Desktop.
Bookmarklet to handle selected text or a pop-up http://www.chrishitchcock.com/post/54347818467/bookmarklet-to-handle-selected-text-or-a-pop-up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var idToSearch=window.getSelection ? | |
window.getSelection().toString() : | |
document.selection.createRange().text; | |
if (idToSearch=== "") { | |
t = prompt("Enter ID",""); | |
} | |
if (idToSearch) { | |
window.location='https://someurl.com/page.html?id='+idToSearch; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment