3 ms·
Why does this site open Wikipedia when I double-click?
by p1mrx 6y ago
Why does this site open Wikipedia when I double-click?
- mikepurvis 6y agoPresumably because of the JavaScript implementing that behaviour in the footer, charmingly pasted in from one of those JavaScript library sites and even still including the original credit: <!-- Original: Nick Simonov (nicks@iln.net) --> <!-- Web Site: http://www.iln.net --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com -->
- thunderbong 6y agoNeither of those sites seem to be available though. The code below that comment is - var NS = (navigator.appName == "Netscape") ? 1 : 0; if (NS) document.captureEvents(Event.DBLCLICK); document.ondblclick = dict; var newwin; function dict() { if (NS) { t = document.getSelection(); opennewwin(t); } else { t = document.selection.createRange(); if(document.selection.type == 'Text' && t.text != '') { document.selection.empty(); opennewwin(t.text); } } } function opennewwin(text) { if (text > '') { newwin = window.open('http://en.wikipedia.org/wiki/Special:Search?search='+text, 's&go=Go'); setTimeout('newwin.focus()', 100); } }
- mikepurvis 6y agoWell yes, I assumed that anyone interested in the actual implementation could go view-source it for themselves. Obviously this was cut-and-pasted into this website's generic footer many, many moons ago, and the fact that it remains long after the original source is gone is part of the charm.