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 7 of 7
  1. #1
    Regular Coder
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    101
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Can one highlight a table cell as a result of google search

    HELLO FOLKS...

    is it possible to highlight a TABLE-CELL instead of the searched word within that cell as a result of a google search.

    thx

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    highlight a TABLE-CELL instead of the searched word within that cell as a result of a google search
    Sorry, it's not clear.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    101
    Thanks
    10
    Thanked 0 Times in 0 Posts
    if I look for something thru "Google Search" and then press the "in Cache" link,
    then the searched words on the linked page would be highlighted.

    Now....is there a JS out there which can recognise, that when a user visits my site, that the word he was searching for, is also going to be highlighted-from-google once my site is opened.

    If yes could a JS highlight the Table-cell where that word would be on my page according to the colors of the highlighted words from google.

    that was hard

  • #4
    Regular Coder
    Join Date
    Apr 2006
    Location
    Northbrook, IL
    Posts
    394
    Thanks
    8
    Thanked 6 Times in 6 Posts
    you can, though not with javascript.

    you would need to get the referrer in the header from the browser on your server. for PHP it is $_SERVER['HTTP_REFERER']. from that you would need to parse the url and write code that would highlight any keywords in the google query on the pages you output to the browser. not difficult at all.

    Leon

  • #5
    Regular Coder
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    101
    Thanks
    10
    Thanked 0 Times in 0 Posts
    thx leon
    but I am not using php, so theres only the html/css or java left

    nigel

  • #6
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    Actually, after looking around about this... you can use the following in javascript to get the address an user came in from:

    Code:
    document.referrer
    After that, it's just a matter of parsing that string and getting the information about the keywords used. Keep in mind, it might not work all that great in all browsers, but it should work.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #7
    Regular Coder
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    101
    Thanks
    10
    Thanked 0 Times in 0 Posts
    hello Eldarrion, THX

    Fistly: I do not have a clue how to implement a JS in a website.

    Secondly: I have found this oner the net:

    Code:
    function getkeywords() {
    var x = document.referrer;
    var lastparturl = 0;
    if (x.search(/google/) != -1) {
    lastparturl = x.indexOf("&btnG=Google+Search"); 
    x = x.slice(38,lastparturl); 
    x = x.concat("via google");
    }
    else if (x.search(/yahoo/) != -1) {
    lastparturl = x.indexOf("&ei=UTF-8&iscqry=&fr=sfp"); 
    x = x.slice(63,lastparturl); 
    x = x.concat("via yahoo");
    }
    else if (x.search(/ask.com/) != -1) {
    lastparturl = x.indexOf("&search=search&qsrc=0&o=0&l=dir"); 
    x = x.slice(25,lastparturl); 
    x = x.concat("via ask");
    }
    else if (x.search(/dogpile/) != -1) {
    lastparturl = x.indexOf("/1/417/TopNavigation/Relevance/iq=true/zoom=off/_iceUrlFlag=7?_IceUrl=true"); 
    x = x.slice(46,lastparturl); 
    x = x.concat("via dogpile");
    }
    else if (x.search(/altavista/) != -1) {
    lastparturl = x.indexOf("&kgs=1&kls=0"); 
    x = x.slice(48,lastparturl); 
    x = x.concat("via altavista");
    }
    else { 
    x = "no keywords available";
    } 
    x = x.replace(/+/, " ");
    return x; 
    }
    could you show me please how to EXACTLY implement this on my website?

    thx
    Nigel


  •  

    Posting Permissions

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