Page 1 of 1

Google CSE Firefox integration.SOLVED

Posted: Fri Feb 08, 2013 12:23 pm
by viking777
I went here: https://www.google.com/cse/ and created a custom search engine to get better results when searching Mint/Ubuntu sites. The result works very well, although it is only presented as a piece of html that is supposed to be embedded into a website. Well I don't want to do that, I want to use it as a search engine in Firefox, but I can't find the way to do this. At the moment the html code is just saved as a file which I click to launch the code in Firefox, but this is very inconvenient, I am sure there must be a way to get it recognised as a search engine, and then I could give it a keyword when I wanted to use it. Anyone know how I could achieve this?

BTW. the firefox addon 'Add to Search Bar' is no help, it just tells me: "new EngineURL: template uses invalid scheme!"

The best I have come up with so far is a keyboard shortcut to launch the file that launches the search window - hardly 'integration' though.

Re: Google CSE Firefox integration.

Posted: Fri Feb 08, 2013 9:04 pm
by zerozero
maybe this will help http://forums.linuxmint.com/viewtopic.php?f=42&p=150700 (if you had a better search engine you would find it yourself :lol: )

Re: Google CSE Firefox integration.

Posted: Sat Feb 09, 2013 6:23 am
by viking777
Fraid not zz :)

That only searches linuxmint.com - I can do that with a simple keyword search. My CSE search engine searches ubuntuforums and omgubuntu as well as linuxmint.com and the mint forums, that is why it's better, and why I would like to integrate it with FF. Right enough it wasn't meant for that purpose, it is meant for embedding in a web site so I will probably have to live with my keyboard shortcut.

Have a go with it if you like, just take this code, paste it into a file, rename it to something like 'search.html' and click it.

Code: Select all

    <script>
(function() {
  var cx = '014925687778169686232:p7fcqjljwgm';
  var gcse = document.createElement('script'); gcse.type = 'text/javascript';
  gcse.async = true;
  gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
      '//www.google.com/cse/cse.js?cx=' + cx;
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>

Re: Google CSE Firefox integration.

Posted: Sat Feb 09, 2013 6:40 am
by zerozero
i tried the CSE google search and as-is (as far as i could see) it's only for embedding in web pages (as you said) or to use as a widget in igoogle's home page (not a very good solution because i read somewhere that igoogle is going away)

but my suggestion above was to use altair's method to integrate the snippet generated by CSE into FF (the same way he did with it's own). mind you that i didn't test it :mrgreen:

Re: Google CSE Firefox integration.

Posted: Sat Feb 09, 2013 7:08 am
by viking777
Sorry zerozereo, my misunderstanding, I tried that suggestion, but the newly created search plugin doesn't even show up. The html code supplied by google doesn't look much like the xml code used in the existing plugins and I have no idea how to convert one to the other.

Good try though - thanks for that :)

Re: Google CSE Firefox integration.

Posted: Fri Feb 15, 2013 6:57 am
by sunewbie
viking777 wrote:I went here: https://www.google.com/cse/ and created a custom search engine to get better results when searching Mint/Ubuntu sites. The result works very well, although it is only presented as a piece of html that is supposed to be embedded into a website. Well I don't want to do that, I want to use it as a search engine in Firefox, but I can't find the way to do this. At the moment the html code is just saved as a file which I click to launch the code in Firefox, but this is very inconvenient, I am sure there must be a way to get it recognised as a search engine, and then I could give it a keyword when I wanted to use it. Anyone know how I could achieve this?

BTW. the firefox addon 'Add to Search Bar' is no help, it just tells me: "new EngineURL: template uses invalid scheme!"

The best I have come up with so far is a keyboard shortcut to launch the file that launches the search window - hardly 'integration' though.
have you tried my search engine - link in my signature ;)

forum thread

also have a look at this thread

http://forums.linuxmint.com/viewtopic.p ... 61&start=0

it points to

https://addons.mozilla.org/en-US/firefo ... earch-bar/

Re: Google CSE Firefox integration.

Posted: Fri Feb 15, 2013 7:36 am
by viking777
Thanks sunnewbie, I did look at your post but it doesn't answer my question - how do I use my own CSE as one of Firefox's default search engines. Your own posts only describe how to embed it in a website or a google home page - I don't have or want either, so it doesn't help me. If you reread my opening post you will see that I have already tried 'Add to search bar' and that doesn't work either.

Thanks for trying to help, but it is not the answer I am looking for.

Re: Google CSE Firefox integration.

Posted: Fri Feb 15, 2013 7:39 am
by sunewbie
I just went to my google CSE - LBSE

Right clicked in the search box

there was an option 'Add as a search engine' in Opera, FF (with addon - Add to search bar v 2.0 enabled ) and Chromium

You can add and define a key word e.g. I gave lb ('l' is small letter 'L') --> save

Just open a new tab, type

Code: Select all

lb [search query]
enjoy :D

Re: Google CSE Firefox integration.

Posted: Fri Feb 15, 2013 7:50 am
by sunewbie
Deleted by sunewbie

Re: Google CSE Firefox integration.

Posted: Fri Feb 15, 2013 8:08 am
by viking777
I am so embarrased for not seeing that, and so grateful to you for pointing it out sunnewbie. I just never even thought of trying that - and neither did others because there is a bug reported for this problem to which I added my reply. Thanks a million it is just what I was looking for :D :D

Re: Google CSE Firefox integration.

Posted: Fri Feb 15, 2013 8:33 am
by sunewbie
viking777 wrote:I am so embarrased for not seeing that, and so grateful to you for pointing it out sunnewbie. I just never even thought of trying that - and neither did others because there is a bug reported for this problem to which I added my reply. Thanks a million it is just what I was looking for :D :D
Glad that it worked. Actually, before I submitted my second post, you had already posted a reply. So don't be embarrassed. :)

sometimes things are very simple for hardcore coders ;)

I wanted to add a tutorial on 'how to LBSE to browser search bar', but was too lazy to take screenshots - even after finding awesome screenshot - a chrome/ium extension, where I can mark and annotate easily. I do not need GIMP or Inkscape or Krita for it ;)

Before a year or so, many 3rd party tools like conduit toolbar did not recognized CSE's, so I could not add my CSE to a custom toolbar. I have quit the toolbar as it takes time to load, so not many will want to install it.

an e.g. of toolbar just in case you got interested.

source

Re: Google CSE Firefox integration.SOLVED

Posted: Fri Feb 15, 2013 8:41 am
by viking777
an e.g. of toolbar just in case you got interested
Thanks for that, but I am not at all keen on browser toolbars.

Re: Google CSE Firefox integration.SOLVED

Posted: Fri Feb 22, 2013 4:26 am
by sunewbie
Not to self promote LBSE, but just incase someone still finds it difficult to add google CSE or any CSE to your Browser, so that you can search directly from address bar, here is the link. I have explained it along with screenshots.