Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I've written a basic stackoverflow ubiquity command.

The initial version refused to execute properly because one of the parameters was not in the correct format. Specifically the postData parameter to browser.loadURI and browser.loadOneTab needs to be a nsIMIMEInputStream object which shog9 pointed out.

The working version of code follows which can also be found at: and installed (if you already have ubiquity) by visiting:

Enjoy, Cheers!

  name: "stackoverflow",
  author: {name: "Aryeh Goldsmith"},
  homepage: "",
  icon: "",
  takes: {search: noun_arb_text},
  license: "MPL",
  description: "Searches the highlighted text on stackoverflow.",
  _version: "55",

  preview: function ( pblock, inputObject) {
    var query = inputObject.text;
    pblock.innerHTML = "Search for " + query + "<br/>";

    var url = "";
    params = {"search-text": query, "hiddenstuff": ''}; url, params, function( html ) {
      var $ = jQuery;
      pblock.innerHTML += "<div style='display:none;'>" + html + "</div>";
      var links = $(pblock).find('.summary h3 a');
      links.each(function (i) {
            if (this.href.match(/^chrome/)) {
              this.href = this.href.replace(/chrome\:\/\/ubiquity/i, "");
            } else if (this.href.match(/^\//)) {
              this.href = "" + this.href;

   = "_blank";

      var ques = $(pblock).find('.summary h3');
      var details = $(pblock).find('.summary .excerpt');
      var out = "<div style='margin-bottom: 6px;'><b>Previewing the first 5 results:</b></div>";
      for (var j = 0; j< ques.size() && j < 5; j++) {
        out += "<div style='padding: 5px;'><b>" + ques[j].innerHTML + "</b><br />";
        out += details[j].innerHTML + "</div>";
      pblock.innerHTML = out;

  execute: function( inputObject ) {
    var query = inputObject.text;
    var url = "";
    var params = {
      "search-text": query,
      hiddenstuff: ""

    var dataString = Utils.paramsToString(params).substring(1);

    var windowManager = Components.classes[";1"].
    var browserWindow = windowManager.getMostRecentWindow("navigator:browser");
    var browser = browserWindow.getBrowser();

    var stringStream = Components.classes[";1"].
    if ("data" in stringStream) // Gecko 1.9 or newer = dataString;
    else // 1.8 or older
      stringStream.setData(dataString, dataString.length);

    var postData = Components.classes[";1"].
    postData.addHeader("Content-Type", "application/x-www-form-urlencoded");
    postData.addContentLength = true;

    if(browser.mCurrentBrowser.currentURI.spec == "about:blank")
      browserWindow.loadURI(url, null, postData, false);
      browser.loadOneTab(url, null, null, postData, false, false);

migration rejected from Sep 8 '14 at 16:41

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Shadow Wizard, CRABOLO, Martijn Pieters, Monica Cellio, ProgramFOX Sep 8 '14 at 16:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question pertains only to a specific site in the Stack Exchange Network. Questions on Meta Stack Exchange should pertain to our network or software that drives it as a whole, within the guidelines defined in the help center. You should ask this question on the meta site where your concern originated." – Shadow Wizard, CRABOLO, Martijn Pieters, Monica Cellio, ProgramFOX
If this question can be reworded to fit the rules in the help center, please edit the question.

Domain redirects to a domain speculator. – Fish Below the Ice Sep 8 '14 at 13:33

Browse other questions tagged .