firefox extension + greasemonkey

Discussion in 'Javascript' started by spx2, Jun 7, 2008.

  1. spx2

    spx2 Guest

    Problem description:
    -------------------

    I'm trying to write a toolbar to automate a search engine that does
    not allow query strings.

    Attempts at a solution
    ----------------------

    One can write a toolbar that uses in some way or the other query
    strings like this

    location.href="htt://site/search?query_string="+text_to_search
    +optional_stuff

    The problem is that the site on which I'm trying to do this does not
    allow query strings.
    So I have to automate it with other methods.

    I've found out that trying to run javascript on a domain different
    than the one
    on which the javascript is hosted is called "Cross domain scripting"
    which is prohibited or
    not allowed...one or the othear.
    Also , I have succeded in writing a script in greasemonkey that can
    access the site and fill the
    search textbox with a word and then hit search automatically.

    The problems remaining are:

    1)how to make the toolbar and greasemnokey communicate ?
    2)how to package greasemonkey and the toolbar together so that when
    installing the toolbar
    on firefox it won't be needed to install them separately.

    The following is the script that I've wrote in greasemonkey for
    automating the page:



    document.getElementById('search').value="gifts";

    var inputs = document.getElementsByTagName("input");
    var idx;
    var btn_search;

    for(idx=0;idx<inputs.length;idx++) {
    if((inputs.item(idx)).getAttribute('name') == 'btn_search') {
    btn_search = inputs.item(idx);
    break;
    }
    }

    var evt = document.createEvent("MouseEvents");
    evt.initMouseEvent("click", true, true, window,0, 0, 0, 0, 0, false,
    false, false, false, 0, null);
    btn_search.dispatchEvent(evt);


    Any suggestions/ideas/alternatives are much appreciated.
     
    spx2, Jun 7, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adrian Holovaty

    ANN: Greasemonkey compiler

    Adrian Holovaty, Apr 27, 2005, in forum: Python
    Replies:
    0
    Views:
    376
    Adrian Holovaty
    Apr 27, 2005
  2. why the lucky stiff
    Replies:
    1
    Views:
    236
    Phil Tomson
    Aug 30, 2005
  3. Lachie
    Replies:
    1
    Views:
    106
    Adam Keys
    Mar 24, 2006
  4. Newton
    Replies:
    2
    Views:
    361
    Lasse Reichstein Nielsen
    Sep 21, 2005
  5. pantagruel
    Replies:
    0
    Views:
    260
    pantagruel
    Feb 17, 2006
Loading...

Share This Page