firefox extension + greasemonkey

S

spx2

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top