Would it not be best to implement this based in the browser search integration thing that allows people to include a search option to a site through the browser, like YouTube, php.net, etc.<br><br>Thanks,<br>Ash<br><a href="http://www.ashleysheridan.co.uk">http://www.ashleysheridan.co.uk</a><br><br>----- Reply message -----<br>From: "Tony Gentilcore" <tonyg@chromium.org><br>Date: Wed, Oct 13, 2010 23:59<br>Subject: [whatwg] SearchBox API<br>To: <whatwg@whatwg.org><br><br>Hi All,<br><br>We're adding instant search integration [1] to Google Chrome, allowing<br>the search provider to communicate suggestions to the user agent.<br><br>If there is interest, we'd like to make sure that we do this in such a<br>way that any search provider or user agent can implement it.<br><br>While the search boxes in most user agents support suggestions via an<br>HTTP API, instant requires a DOM API. We propose exposing a<br>window.navigator.searchBox object. There is some precedence for this<br>with window.navigator.registerProtocolHandler()/registerContentHandler()<br>[2].<br><br>Is this something that others are interested in? If so, any feedback<br>on our working API [3]?<br><br>-Tony<br><br>[1] <a href="http://googlesystem.blogspot.com/2010/09/instant-search-in-google-chrome.html">http://googlesystem.blogspot.com/2010/09/instant-search-in-google-chrome.html</a><br>[2] <a href="http://dev.w3.org/html5/spec/Overview.html#navigator">http://dev.w3.org/html5/spec/Overview.html#navigator</a><br>[3]<br><br>interface SearchBox {<br> // Search query and cursor position.<br> readonly attribute DOMString value;<br> readonly attribute unsigned long selectionStart;<br> readonly attribute unsigned long selectionEnd;<br><br> // Dimensions of the portion of the search box (e.g. a dropdown)<br> // that overlaps the window.<br> readonly attribute unsigned long x;<br> readonly attribute unsigned long y;<br> readonly attribute unsigned long width;<br> readonly attribute unsigned long height;<br><br> // Set ordered suggestions. Valid for current this.value.<br> void setSuggestions(in DOMStringArray suggestions);<br><br> // Notification that the user has changed the input value.<br>          attribute Function onchange;<br><br> // Notification that the user has committed input (e.g. pressed enter).<br>          attribute Function onsubmit;<br><br> // Notification that the user has selected a suggestion (e.g. down<br>arrow to suggestion).<br>          attribute Function onselect;<br><br> // Notification that the user has cancelled input (e.g. closed dropdown).<br>          attribute Function oncancel;<br><br> // Notification that the dimensions of the overlapping region have changed.<br>          attribute Function onresize;<br>}<br><br>[Supplemental]<br>interface NavigatorAbilities {<br> // Raises permission denied if page isn't default search provider.<br> readonly attribute SearchBox searchBox;<br>}<br><br>// Example usage.<br>var searchBox = window.navigator.searchBox;<br>searchBox.onchange = function() {<br>  if (this.selectionStart == this.selectionEnd &&<br>      this.selectionStart == this.value.length)<br>    alert('Cursor is at end of input');<br><br>  alert('Setting suggestions for: ' + this.value);<br>  this.setSuggestions(["one", "two"]);<br>}<br>searchBox.onsubmit = function() {<br>  alert('User searched for: ' + this.value);<br>}<br>searchBox.onselect = function() {<br>  alert('User selected suggestion: ' + this.value);<br>}<br>searchBox.oncancel = function() {<br>  alert('Query when user cancelled: ' + this.value);<br>}<br>searchBox.onresize = function() {<br>  alert('Resized to: ' +<br>        [this.x,<br>         this.y,<br>         this.width,<br>         this.height].join(','));<br>}<br><br><br>