Get National Weather Service conditions, forecast directly from Chrome omnibar

I love Google Chrome. I was not exactly an early adopter of the browser, but now, I’m addicted. And one of my favorite features is the omnibar, that bar across the top where you can enter a web address, bookmark name, or search term and be magically whisked to the desired location.

One of the best things of the omnibar is the search functionality. By default, this allows the user to search Google, but Chrome also comes out of the proverbial box with a number of other searchers which can be activated with the use of a keyword. For instance, if you enter amazon.com, followed by a space, you can search Amazon directly from the omnibar.

With just a few keystrokes, you can also build custom searchers. So, for example, I use Google Drive for almost everything. Instead of going to Google Drive and then entering a search to find my stuff, I built a custom searcher so that I can enter “gdrive <search term>” and be taken directly to a page of my matching documents and such.

I am also something of a weather fan. It’s more than a necessity for me; I am thoroughly fascinated by the weather. And so I like to visit sites which tell me about the weather. To this end, I used to visit weather.com, the site of The Weather Channel two or three times per day. But I have found over the years that their site has become bloated with ads, heavy graphics, and even occasional videos which really just distract from what I’m really after: the weather. Plus, I have found over the years that the National Weather Service has more localized and more accurate information for my location. And when an alert or warning is issued, why get the relevant information through a proxy when I can go straight to the source. Thus, I find myself using weather.gov – the NWS’ website – more and more.

But every time I went, I had to either use their map to locate the area I want (and thus go through at least two clicks to get to the locale I was looking for) or enter the city/state or zip code in the search box and wait for a second page to load.

This morning, I had the brilliant idea to write a Chrome searcher for weather.gov to simplify this process. (I know, I’m slow.) Initially, I was concerned because the form for searching by city/state or zip code submitted information via the post method rather than slapping the data directly into the URL. But with a little experimentation, I quickly found that the script behind the form wasn’t picky. So a few keystrokes later, I can search weather.gov directly from the omnibar. Here’s how I did it:

Step 1: Go to Chrome’s Settings panel. You can access this through the menu at the far right of the window or by opening a new tab and entering “chrome://settings” (without the quotation marks) in the omnibar.

Step 2: Scroll down to the Search section of the settings and press the “Manage search engines…” button.

Step 3: Scroll to the very bottom of the list of search engines until you find three inputs, the first of which will say “Add a new search engine”

Step 4: In that first input, enter “weather.gov” (without quotation marks). And in the second, enter “nws” (again, skip the quotes).

Step 5: Here is where the magic happens. In the third input, enter this: http://www.crh.noaa.gov/zipcity.php?siteid=dmx&inputstring=%s

Step 6: Click “Done” and close the settings panel.

Step 7: Click on the omnibox at the top of the window, type “nws <your zip code>”, and hit enter. You should be whisked straight away to the NWS’ page for your location.

As alluded above, you can do this with a large number of sites, simply by understanding the magic of step 5. It’s really rather simple. When you run a search on a given site, check the resulting URL for the query string. Replace that with the %s placeholder and plug the resulting string into that third input, and you’re in business.

The caveat is that sometimes, as in the case of weather.gov, the actual search script redirects the browser so that you end up at a URL that doesn’t include the search string. In that case, you will need to do some dissecting of the search form. So, for instance, I used Chrome’s developer tools to inspect the search form at weather.gov. I then took the domain name (i.e., http://www.crh.noaa.gov), added the form element’s action attribute (i.e., /zipcity.php), and then gathered the names and values of the inputs the form was submitting. In this case, the only relevant inputs were called “inputstring” (i.e., the actual search string) and “siteid,” which had a static value of dmx. Thus, the query string in the URL: ?siteid=dmx&inputstring=%s (note the %s placeholder at the end).

And that was that. Now, I can search the NWS from my omnibar. And you can take the same basic principles and search just about anything else, too.

Advertisements

0 Responses to “Get National Weather Service conditions, forecast directly from Chrome omnibar”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: