Hacker News new | past | comments | ask | show | jobs | submit login

Does anyone want to explain how this works? I had no idea dragging onto a tab could start up javascript on a page. It's amazing!



Here is an example that will search hacker news (via google). This is based on the wikipedia example:

javascript:function se(d) {return d.selection ? d.selection.createRange().text : d.getSelection()} s = se(document); for (i=0; i<frames.length && !s; i++) s = se(frames[i].document); if (!s || s=='') s = prompt('Enter%20search%20terms%20for%20HackerNews',''); var goo = 'http:'; var g = '//'; var le = 'www.google.com/'; open(goo + g + le + (s ? '#q=site%3Anews.ycombinator.com ' + encodeURIComponent(s) : '')).focus();


What you're talking about has been around forever, and is called a "bookmarklet"

http://en.wikipedia.org/wiki/Bookmarklet


What a terrible explanation..


I thought it was bad too, so I blew the shit out of it!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: