开发者

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

开发者 https://www.devze.com 2023-01-27 11:17 出处:网络
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.

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 defi开发者_高级运维ne another source, like a library method from a chrome-content js-file that returns an object?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消