javascript to open page in new tab

slugger

Banned
Hi,
I recently dragged this bookmarklet into my browser [forgot the site - will post it if it remember].

Code:
javascript:d=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);d=d.replace(/\r\n|\r|\n/g,"%20,");if(!d)d=prompt("Enter%20the%20words:",%20"");if(d!=null)location="http://www.google.com/search?q=define:"+escape(d).replace(/%20/g,"+");void(0);

What it does is, once you highlight a word in the browser and then click on the bookmarklet, it will search Google using the define: search operator - very nifty for imporving vocabulary
As seen from the code, the search page opens up replacing the original page where that word had appeared - very inconvininet as you will have to go back again to read it

As I have no knowledge of javascript, my attempts at trying to modify the code to get the search page open up in a new tab, leaving the original page untouched has failed till now

Can some kind soul please do it for me

Thanks :)
 

victor_rambo

हॉर्न ओके प्लीज़
Code:
javascript:d=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);d=d.replace(/\r\n|\r|\n/g,"%20,");if(!d)d=prompt("Enter%20the%20words:",%20"");if(d!=null)window.open("http://www.google.com/search?q=define:"+escape(d).replace(/%20/g,"+"));void(0);
 
Top Bottom