搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

integrate custom search to own search bar

  • 10 回覆
  • 2 有這個問題
  • 11 次檢視
  • 最近回覆由 neyo

more options

i am looking for a way to add any search to the search bar. basically do what this extension did automatically: https://addons.mozilla.org/de/firefox/addon/add-to-search-bar/ ( and similarly this one: https://addons.mozilla.org/de/firefox/addon/search-engines-export-import/ ) before the extension i used to edit an xml file, but that seems gone as well. how to do it now?

i am looking for a way to add any search to the search bar. basically do what this extension did automatically: https://addons.mozilla.org/de/firefox/addon/add-to-search-bar/ ( and similarly this one: https://addons.mozilla.org/de/firefox/addon/search-engines-export-import/ ) before the extension i used to edit an xml file, but that seems gone as well. how to do it now?

所有回覆 (10)

more options

Addons aren't a FF support item here that is through the Addon that you must ask that question.

more options

I get what you mean. Mozilla screw-up the ability for user to create theor own custom search engines on their own PC's. User installed search engines aren't used from the searchplugins folder any longer, which prevents the user from editing a "standard" installed search engine to be edited. Firefox now 'converts' or moves the search plugins contents into search.json.mozlz4 file in the Profile folder which is used within Firefox for the search engines.

One look at the contents of that search.json.mozlz4 file I figured I had to come up with a better way of adding any new, modified search engine that I wanted.


Suggestion: http://mycroftproject.com/search-engines.html Was created by Mozilla many years ago and within the last 4 or 5 years is was spun off to its own domain away from MozDev.

What I have done a few times in the last couple of years is to find an already created search engine from Mycroft and saved it to disc. Then I edited the xml file and saved it as a "new" search engine to the Mycroft website. Once I did that I installed it into the Firefox Profile directly from Mycroft to add it to that Firefox version. Pain in the @ss workaround to say the least, but I have so many search plugins installed from years ago that with the old search scheme (like prior to the "new" search scheme that came in Firefox 34.0.5) the search engine drop-down menu went down to the Task Bar with 36 search engines and I would need to get rid of one search engine to stop the scroll bar from appearing.


I'm pretty sure that an "editor" for editing that search.json.mozlz4 file could be created, like maybe online to keep it "simpler" for users and not have to be integrated as an extension for Firefox, but I have no idea where to start. And the priority for me with already maxing-out the limited space that Mozilla provides in newer version of Firefox is quite low. At the rate I am going with my transition over to Quantum I may not switch my primary browser over to a Quantum version this year. I am an "anti-early adopter" or a slug with adapting to large changes that Mozilla has been making to Firefox, since Firefox 4.0 came out in March 2011.

I hope my diatribe helps you come up with a solution for your use of Firefox.

edited to fix the formatting of bold type face

由 the-edmeister 於 修改

more options

WestEnd said

Addons aren't a FF support item here that is through the Addon that you must ask that question.

People can still ask for how to use with Firefox an extension, theme, plugins, search engines and such here.

more options

Hi neyo, I think in the short run more users are using the keyword feature from the address bar. If you're not familiar:

Setup

On the site where you want to send your search:

(A) right-click (one-button: Ctrl+click) the search box (B) click Add Keyword for this Search (C) Edit the name as desired (D) Enter the keyword you want to use for searching, for example, yt for YouTube (example screenshot below) (E) Click the Save button

Use

In the address bar, type your keyword (e.g., yt) followed by a space followed by your query. Firefox should show the intended search in the address bar drop-down (example screenshot below).


It might be possible for someone to create an extension that would similarly extract the needed information to build the search engine (except perhaps for the icon?), create the proper XML format, and push it to Firefox to install.

(If I had to build this, I would look at the window.external.AddSearchProvider(url_to_xml_file) method, but I don't know whether extensions are allowed to use that method, or whether a URL to a file can be replaced by a "blob" generated on the fly. There must be a better way...)

more options

the-edmeister said

What I have done a few times in the last couple of years is to find an already created search engine from Mycroft and saved it to disc. Then I edited the xml file and saved it as a "new" search engine to the Mycroft website.

Someone point this site out to me as a simpler page to build new search engines: http://ready.to/search/en/

I haven't tried it myself.

more options

Then the question is, how do you install it in Firefox?

I wonder if drag'n'drop it into Firefox works for search.xml files works now as it does with extensions that were saved to hard disk?

I don't recall ever trying to do that with search.xml files, but then again I haven't messed with creating custom search engines too often in the last 10 or 12 years, although I did a good number back in 2004 thru 2007.

more options

You can run this code via the command line of the Browser Console.


/* load search engine via local XML file */
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
fp.init(window,"Open file",Ci.nsIFilePicker.modeOpen);
fp.appendFilters(Ci.nsIFilePicker.filterXML);
fp.open((rv) => {
  if (rv == Ci.nsIFilePicker.returnOK) {
   var path = fp.file.path;
   var url = OS.Path.toFileURI(path);
   Services.search.addEngine(url, null, null, false);
  }
})
more options

cor-el said

You can run this code via the command line of the Browser Console. ...

I will test this out thoroughly, it seems the best so far, albeit unnecessarily hidden.

more options

jscher2000 said </blockquote> Someone point this site out to me as a simpler page to build new search engines: http://ready.to/search/en/ </blockquote> it is not consistent, it vanished with every update. also, it has no option for an icon in the menu.

more options

jscher2000 said

Hi neyo, I think in the short run more users are using the keyword feature from the address bar.

Does not work for all sites, some use a strange formatting for their search.