Thursday, May 10, 2012

Manipulating URLs with long query strings using Chrome

Website URLs, especially search engine ones as well as REST API with lots of parameters, are getting longer and longer while browsers haven't kept up with this and keep their URL bars short. When debugging lengthy URLs such as those produced when using Apache's Solr, most of the time, I end up copying/pasting the URL into a text editor that supports line wrapping and then making the necessary changes. As you can imagine, this is incredibly time consuming and error prone which made me wonder, "Why isn't there a browser extension to make it easier to edit URLs with long query strings?" After much searching, I couldn't find one so I wrote one!

Chrome Extension

  1. Git clone the repository URL( https://github.com/ANithian/url_edit_extension )
  2. In Chrome, enter chrome://extensions into the URL bar
  3. Make sure the "Developer Mode" box is checked
  4. Click "Load Unpacked Extension" and navigate to where you cloned the repo in step 1. After installing the extension, you should see an icon:







Next, visit a URL that contains a long query string (http://www.zvents.com/search?swhat=music&swhen=tomorrow&swhere=Berkeley%2CCA&commit=Search&st_select=any&search=true&svt=text&srss=). Then click the icon to bring up the URL editor:

To edit the parameter value for "swhat", double click on the value for "swhat" and change it to "comedy" and then click the "Update" button. You should see the URL change to http://www.zvents.com/search?swhat=music&swhen=tomorrow&swhere=Berkeley%2CCA&commit=Search&st_select=any&search=true&svt=text&srss=

That's pretty much it! The only thing you may notice is that the extension may flicker which I believe is a bug in Chrome that should be addressed in v19 (http://code.google.com/p/chromium/issues/detail?id=58816). If you have any suggestions/feedback on this extension, I'd love to hear it. Please submit an issue/feature/bug request at the github location (https://github.com/ANithian/url_edit_extension/issues). Happy editing!

6 comments:

  1. Dear Amit, thank you for writing the extension because I'm tired of editing SOLR URLs too. But awfully Google Chrome doesn't allow installing extensions from anywhere except Chrome Web Store.

    Do you know any workaround or would you please post the extension to Chrome Web Store please?

    ReplyDelete
    Replies
    1. I may post this to the chrome store and pay the fee. Another option is to set your Chrome to developer mode (checking the Developer mode box) and loading my extension that way. If this doesn't work then I'll post to the Chrome Store and post an update.

      Delete
    2. Thank you very much! Checking Developer mode helped and I've successfully installed the extension. Don't bother about pushing it into Chrome Store :)

      Delete
  2. I'd love to try this, but not quite grokking the how to get it loaded? something to click on?

    ReplyDelete
    Replies
    1. Hi Eric,

      Sorry about this. I updated the article to reflect (hopefully) better installation instructions. Let me know if this doesn't make sense. I don't seem to see the ability to download (pre-packaged) files on Github anymore (unless I am missing something).

      Cheers!

      Delete