Wednesday, 22 August 2012

Chrome NCR Extension

No Country Redirect (NCR) - Chrome extension (logo design by nkao-art.com)

NCR : No Country Redirect
I've finally made my first Chrome Extension. This as I saw the need of something to avoid automatic country redirections for two specific Google sites: blogspot.com and google.com. I've been annoyed for a long time that when visiting google.com I get redirected to for example google.no when in Norway, google.co.uk when in the UK and so on. Same thing goes for visiting blogger blogs (blogspot.com). When I type in .com I would like to stay on the .com pages. This extension is the solution to this problem.

The extension can be found, downloaded, installed and reviewed following this link to the Chrome Web Store:  https://chrome.google.com/webstore/detail/ciboebddidackjicoeoiigdnbmchkdll .

I didn't bother writing a tutorial on how I did this, as there already are heaps of nice once out there. This post is just a summary on what I did, including links to a few nifty resources on the subject. However, if you want to check out the source code for the extension that can be done at code.google.com github.com.

13th of August
It all started with some searching on the Net. I found the following pages specially useful:

Hello, World! - just to get started : http://developer.chrome.com/extensions/getstarted.html
For dummies - for some extra info : http://www.jefvlamings.com/blog/chrome-extensions-for-dummies/
Docs from Google - for all the details : http://developer.chrome.com/extensions/docs.html
Docs from Google - for all the details : http://developer.chrome.com/extensions/devguide.html
Sample code - for seeing it in action : https://developer.chrome.com/extensions/samples.html
And stackoverflow.com also being extremely handy for finding answers to challenges.

After quite a short period of time I had my first extension up and running. I used the Page action by URL sample as a starting point. The tabs documentation was also very handy for me.

Version 0.1 beta beta beta. Still using the icons from the sample code.

14th of August
Ran into problems as I failed reloading my plugin while I was developing. Despite clicking the extension's "Reload (Ctrl + R)" link the extension files didn't get reloaded when I was debugging. The console showed old debugging messages in stead of new ones. When I did a "Ctrl + R" in the debugging window as well the problem got solved though. That seemed to refresh the extension code. Note that I later realised that despite of running exact version of Chrome, with the exact same extensions, this only is the problem on one of my computers. No idea why.

Debugging in an early version.

klevstul.com got NCR'ified as well, just for testing purposes.

16th of August
Due to wonderful summer weather in Norway the development has almost been standing still the last couple of days. The first working version of the plugin is ready now though. Did spend some time getting the regular expressions correct. Might have to do some more tweaking, as the plugin is not bulletproof yet. Will start running the plugin in my own browser now, just to see how it works.

Contacted Neli, my favourite designer and asked for her help on a logo for this plugin. Luckily she found the challenge interesting and wanted to help me out. Note that on the images directly below I'm just using a temporarily icon, from the sample code.

Ready for testing.

NCR has been added to Chrome.

Looked into memory usage for the extension as well. Seemed OK. Did some optimisation of the code to avoid a few loops.

Task Manager for Google Chrome.

17th of August
Decided to create an option page for the extension, enabling the user to turn on and off the domains to be NCR'ified. Hence I needed to learn how to do this as well, including how to store values.

The example from Google containing an error.

I struggled a bit since the example page contained an error. The code did not close the script tag. It is of course supposed to be
<script src="options.js"></script>
in stead of
<script src="options.js">

I also had problems due to security changes (improvements) done to version two of the manifest. The second version is stricter, which is good though, than the first, hence executing JavaScript has to be done differently.

18th of August
Solved the problems related to executing JavaScript, however I disabled the entire options page and decided to instead implement options as a feature in a later version of the extension. The first version will be options free.

Received the great logo from Neli (as a birthday present - thank you!), and implemented that in the extension.

Page action shows icon after URL.

New logo, this time an own unique logo.

Packed the extension and visited the Chrome Web Store Developer Dashboard. It was ready for prime time!



And after a few clicks my first extension was available to the world. It's going to be interesting to see how many user that will install it. If you're interested it can be downloaded from here. I will update the extension with new features soonish. As soon as you have installed the extension the updates will happen automatically for you as a user.

Published, on the great day 18th of August.

Available in a Chrome Web Store near you!

22nd of August
Found several of bugs in the first version of the extension. Hence I've been debugging for a few days. Ended up with re-writing main parts of the code. Finally it now seems to be working just as planned. The new version has been published to the Chrome Web Store and is to be rolled out to all active users (two in the number, not including myself, yay).

2 users, not including me, this extension is going viral!

3 comments:

  1. Some keywords for this post (added for searching purposes):

    How to stop Google From Redirecting Me To Local Country Google Search

    Stop Google Country IP Redirects

    Free Google redirect disabling tool

    how to avoid google country redirect

    how to prevent google country forward

    how to avoid blogger blogspot country redirect

    how to disable google.com country redirect

    stop google.com redirecting to local country or language version

    ReplyDelete
  2. You are awesome, man, thanks! Check one feature-request on github! ;)

    ReplyDelete
    Replies
    1. thanks a lot, SkyWinder. i have looked at the nifty feature request, and will for sure consider it for next version.

      cheers,
      frode.

      Delete

Allowed HTML tags:
<b>bold</b>
<strong>strong</strong>
<i>italics</i>
<em>emphasis</em>
<a href="">hyperlink</a>


Please, show the courtesy of identifying yourself when adding a comment. Anonymous comments will, most likely, be removed.