When bookmarks are not enough...

When bookmarks are not enough... 

I just want to type tr whatever into Chrome's search bar and get a translation of whatever:

The quickest way to get a translation, 
in this case of "bookmark". Read below how to set it up.



I knew this was possible and searched for it using the terms quicksearch, shortcuts and extended bookmarks. But the real feature name is site search. Let's see how we set it up:
  • in Chrome's settings menu, select search engine -> manage search engines and site search:
  • scroll to "site search", click "add":

  • enter a keyword and URL to be composed from the string you give after the keyword:

You see that you configure a keyword here (in this example tr) and tell the browser to move to an URL on this keyword. This URL can contain the string you enter after they keyword. You just write %s and the URL will contain the string at this place.

OK, cool thing, especially because it is so versatile. I recall in the KDE project we had a similar thing for our browser Konqueror. You could configure this feature for:
  • translate: Just type tr whatever and it will translate whatever into your default language
  • translate: Just type trp whatever and it will translate whatever into Polish... Maybe you have several languages you are dealing with.
  • wikipedia: Just type wp whatever and you will get wikipedia's article on "whatever".
  • SAP notes: Just type sapnote 300900 and get SAP note 300900 shown.
  • stock courses: Just type sc whatever and you will get the stock course of the stock whatever.
OK, the last one was not so easy and this is what sparked this blog in the first place. My first employer was BASF, so I will use them as example stock here. My favorite stock website is comdirect. When I search there for BASF, I get redirected to

https://www.comdirect.de/inf/aktien/detail/uebersicht.html?SEARCH_REDIRECT=true&REDIRECT_TYPE=WHITELISTED&REFERER=search.general&ID_NOTATION=37967484&SEARCH_VALUE=BASF

and now, just replacing "BASF" by another stock does not work :(
This is obviously because comdirect first tries to find out some ID_NOTATION and so on in multiple redirects. But what is the first URL the thing will call when I enter BASF?
Chrome's network debugging feature helped. I selected Chrome -> more tools -> developer tools -> network. Then I got all redirect history displayed:

If you can't find out the URL to point to, 
use Chrome's network tool

With this, I could easily set up a shortcut cd to point me to the right address. cd BASF now shows me the BASF stock on comdirekt thanks to this shortcut:


Now, tell me what you use shortcuts for, please :)

Comments

Popular posts from this blog

Set up a webcam with Linux

PuTTY: No supported authentication methods available

My SAT>IP Server