Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-Suggest Source from JS-Chrome-Content Function in Firefox Addon

Regarding Mozillas Auto-Suggest Extension Tutorial I'd like to design my own auto-suggest extension. The tutorial uses json defined in the autocompletesearchparam param as suggestion-source.

How would I define another source, like a library method from a chrome-content js-file that returns an object?

like image 844
pex Avatar asked Nov 05 '22 05:11

pex


1 Answers

Just grab that object and serialize it, using something like JSON.stringify() (assuming its in the format that the extension wants, if not, you'll need to manipulate your object). Now attach your result string to the the "autocompletesearchparam" attribute or "searchParam" property of your element. Should be as simple as that.

https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/stringify

like image 119
two7s_clash Avatar answered Nov 11 '22 04:11

two7s_clash