简体   繁体   中英

chrome extension search_url_post_params search provider override

I'm currently overriding chrome's default search provider with the "search_url" property under the manifest's "chrome_settings_overrides". I'm overriding this search url with a url that will redirect to my own Flask server. I now want to include post parameters during this redirection and read them on the server.

Google's docs outlines the "search_url_post_params" but without much explanation as to how this property is used in the extension's search request let alone Flask's "request" object on the server-side.

How do I include post parameters in the default search url of a chrome extension? Here is the override settings in my manifest.json

"chrome_settings_overrides": {
    "search_provider": {
      "is_default": true,
      "encoding": "UTF-8",
      "keyword": "My Extension",
      "name": "My Extension",
      "favicon_url": "https://myflaskapp.com",
      "search_url": "http://myflaskapp.com/search?query={searchTerms}",
      "suggest_url": "https://myflaskapp.com/suggest?prefix={searchTerms}",
      "search_url_post_params": "testparam=extension"
    }
  }

I want to read the post param on my Flask server in some way like this:

@app.route('/search', methods=['GET', 'POST']
def search():
    testparam = request.form['testparam']

search_url_post_params doesn't actually work . And it doesn't look like anyone is working on it.

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