简体   繁体   中英

How can I add in another description to my chrome extension?

Okay guys, I am creating a chrome extension which allows my to use the omnibox feature in google chrome. So for example, When I type the word "face" and select tab, it allows be to use the chrome address bar as a searchbar for facebook. I am now looking to add Twitter to the chrome extension and I am struggling to do this. Below is my javascript file which works with facebook

function resetDefaultSuggestion() { 
    chrome.omnibox.setDefaultSuggestion({
        description: 'face: Search the Facebook API for %s'
        description: 'twitter: Search twitter API for %s'
    });
}

resetDefaultSuggestion();

function navigate(url) {
    chrome.tabs.query({active:true, currentWindow: true}, function (tabs) {
        chrome.tabs.update(tabs[0].id, {url: url});
    });
}

chrome.omnibox.onInputEntered.addListener(function(text) {  
  navigate("https://www.facebook.com/search/results/?q=" + text);
});

This is my manifest.JSON file below, any help at all would be appreciated:

{

    "name": "Facebook People Search", 
    "description": "Are you always facebook searching people? Install this plugin to make it even faster!",
    "omnibox": { "keyword" : "face" },
    "icons": {
    "16": "facebook.png"
    },
    "background": {
    "scripts": ["background.js"]
    },
        "version": "1.0",
    "minimum_chrome_version": "9",
    "manifest_version": 2
}

Nope, no can do.

Only one keyword per extension.

You'll need to have some kind of common prefix that's used for all queries to your extension.

For example, s , so you can do s face or sf for facebook and st for twitter. See how Chromium Search does it for different search types.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM