开发者

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 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜