Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home for chromium.org
« Groups Home
Message from discussion window.chrome.searchBox has no functionality?

Received: by 10.101.137.21 with SMTP id p21mr3188552ann.26.1334987369764;
        Fri, 20 Apr 2012 22:49:29 -0700 (PDT)
X-BeenThere: chromium-disc...@chromium.org
Received: by 10.236.134.204 with SMTP id s52ls6432406yhi.0.gmail; Fri, 20 Apr
 2012 22:49:16 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.236.115.169 with SMTP id e29mr1218737yhh.16.1334987356790;
 Fri, 20 Apr 2012 22:49:16 -0700 (PDT)
Authentication-Results: ls.google.com; spf=pass (google.com: domain of
 tblob...@gmail.com designates internal as permitted sender)
 smtp.mail=tblob...@gmail.com; dkim=pass
 header...@gmail.com
Received: by p6g2000yqi.googlegroups.com with HTTP; Fri, 20 Apr 2012 22:49:16
 -0700 (PDT)
Date: Fri, 20 Apr 2012 22:49:16 -0700 (PDT)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.19 (KHTML,
 like Gecko) Chrome/18.0.1025.151 Safari/535.19,gzip(gfe)
Message-ID: <23ce9b14-25b3-42f0-b858-9619e5fdf6b8@p6g2000yqi.googlegroups.com>
Subject: window.chrome.searchBox has no functionality?
From: devaholic <tblob...@gmail.com>
To: Chromium-discuss <chromium-disc...@chromium.org>
Content-Type: text/plain; charset=ISO-8859-1

Running the example from localhost, with the default search engine set
(to localhost) returns a searchBox object but it has no functionality
(code below).

Further investigation revealed that the `window.chrome.searchBox`
exists on all websites and not just the domain for the default search
engine (despite the api document saying otherwise).

Also, even with google.com set to the default search engine in chrome
the `window.chrome.searchBox.value` and other properties appear to
have no functionality although the omnibox instant search clearly
works for chrome. Is `google.com` using some other implementation to
interact with the omni box? If so is there a way to interface with the
functional implementation?

Reference: http://dev.chromium.org/searchbox

I also noticed that bing.com is able to populate the search
suggestions in the dropdown menu, but does not have instant search
interaction with the DOM. On a slightly different note, is there any
documentation to interface with the autocomplete, less the Onibox +
DOM interaction?


Example code:

var searchBox = (window.navigator.searchBox ||
window.chrome.searchBox)
searchBox.onchange = function() {
  if (this.selectionStart == this.selectionEnd &&
      this.selectionStart == this.value.length)
    alert('Cursor is at end of input');

  alert('Setting suggestions for: ' + this.value);
  this.setSuggestions({
    suggestions: [
      { value: "one"
      },
      { value: "two"
      }
    ]
  });
}
searchBox.onsubmit = function() {
  alert('User searched for: ' + this.value);
}
searchBox.oncancel = function() {
  alert('Query when user cancelled: ' + this.value);
}
searchBox.onresize = function() {
  alert('Resized to: ' +
        [this.x,
         this.y,
         this.width,
         this.height].join(','));
}

Thanks!