Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening search result in new page

    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

  • #2
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,958
    Thanks
    120
    Thanked 76 Times in 76 Posts
    this will do the trick:

    Code:
     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.

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thankyou!

    That was great! Thanks! Orgone


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •