...

View Full Version : Opening search result in new page



Orgone
02-15-2007, 04:48 PM
This script (put on your browser shortcuts bar) allows you to highlight any word on the page you are currently browsing, and on clicking, be taken to the wikipedia entry for that term:

The problem is, i would like it to open the entry in a new page or tab, but i cant work out how to. Can anyone help?

javascript:q = "" + (window.getSelection ? window.getSelection() :
document.getSelection ? document.getSelection() :
document.selection.createRange().text);
if (!q) q = prompt("You didn't select any text. Enter a search phrase:", "");
if (q!=null) location="http://en.wikipedia.org/wiki/" + escape(q).replace(/ /g, "+"); void 0

Thanks, Orgone

BubikolRamios
02-15-2007, 05:17 PM
this will do the trick:




function test()
{
javascript:q = "" + (window.getSelection ? window.getSelection() :
document.getSelection ? document.getSelection() :
document.selection.createRange().text);
if (!q) q = prompt("You didn't select any text. Enter a search phrase:", "");
/*
if (q!=null)
{
location="http://en.wikipedia.org/wiki/" + escape(q).replace(/ /g, "+");
}
void 0;
*/

if (q!=null)
{
WindowObjectReference = window.open("http://en.wikipedia.org/wiki/" + escape(q).replace(/ /g, "+"),
"DescriptiveWindowName",
"resizable=no,scrollbars=yes,status=no");
}
void 0;
}



Regards.

Orgone
02-15-2007, 05:42 PM
That was great! Thanks! Orgone



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum