# Capture the searchbox's contents

**URL:** <https://discourse.mozilla.org/t/capture-the-searchboxs-contents/16994>\
**Category:** Development\
**Created:** [July 10, 2017, 9:03pm UTC](https://discourse.mozilla.org/t/capture-the-searchboxs-contents/16994 "2017-07-10T21:03:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![otherrealm](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@otherrealm](https://discourse.mozilla.org/u/otherrealm)\
**Post date:** [July 10, 2017, 9:03pm UTC](https://discourse.mozilla.org/t/capture-the-searchboxs-contents/16994/1 "2017-07-10T21:03:45Z")

</div>

I am updating my extension that adds search buttons to the toolbar so that you do not need to keep first clicking on the search box for the search options to show up, but there is no function that I have seen in the new API to capture the searchbox’s contents. How do I grab its contents in the new api? The separate search box is the main reason I use Firefox – I don’t understand why people like to type same content over and over again, every time they want to do the same search in a different engine.  
Here is my old code - will this still work in the new API? (Just beginning the redesign)

> ```
> //this function fires when a search button is clicked
> function returnURL(tabURL) {
> return function () {
> tabs.activeTab.url = tabURL + getMostRecentBrowserWindow().document.getElementById("searchbar").value;
> };
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [July 10, 2017, 9:21pm UTC](https://discourse.mozilla.org/t/capture-the-searchboxs-contents/16994/2 "2017-07-10T21:21:17Z")

</div>

> [@otherrealm](#):
>
> there is no function that I have seen in the new API to capture the searchbox’s contents

I don’t think there is one. And since it is planned to remove the search box from the default layout (but keep it as an UI option), I don’t think one will be added. So to answer your final question: No.

_But_ Firefox will add the capability to add custom `iframe`-based UI elements. You could implement your own search box with custom semantics.

* * *

> I don’t understand why people like to type same content over and over again, every time they want to do the same search in a different engine.

Quite frankly, if you regularly need to consult more than one search engine, then your engines suck - or you don’t know how to use them. And to avoid typing stuff twice, there is the clipboard.

---

<div class="post-metadata">

**Author:** ![otherrealm](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@otherrealm](https://discourse.mozilla.org/u/otherrealm)\
**Post date:** [July 11, 2017, 1:58am UTC](https://discourse.mozilla.org/t/capture-the-searchboxs-contents/16994/3 "2017-07-11T01:58:42Z")

</div>

So these iFrames will be in the toolbar?

I agree that google, duck-duck-go and yahoo have their limitations (although I wouldn’t go so far as say they suck) … plus there is the SearchWP plugin. I would recommend having the default be have all the available features present and let people take the ones they don’t use away, rather than people needing find things (and new users not knowing about them).

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [July 11, 2017, 3:20pm UTC](https://discourse.mozilla.org/t/capture-the-searchboxs-contents/16994/4 "2017-07-11T15:20:43Z")

</div>

> [@otherrealm](#):
>
> So these iFrames will be in the toolbar?

At least that was the notion the last time I heard about it a couple of month ago.

---

<div class="post-metadata">

**Author:** ![otherrealm](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@otherrealm](https://discourse.mozilla.org/u/otherrealm)\
**Post date:** [July 11, 2017, 3:32pm UTC](https://discourse.mozilla.org/t/capture-the-searchboxs-contents/16994/5 "2017-07-11T15:32:13Z")

</div>

That would be great - do you know if there is some place I can find out more about the details/progress in this endeavor?

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [July 11, 2017, 3:34pm UTC](https://discourse.mozilla.org/t/capture-the-searchboxs-contents/16994/6 "2017-07-11T15:34:56Z")

</div>

There will be a bug on bugzilla, I don’t remember a number, though. You should search for `WebExtension` and `toolbar`.

---

<div class="post-metadata">

**Author:** ![otherrealm](https://avatars.discourse-cdn.com/v4/letter/o/e274bd/32.png) [@otherrealm](https://discourse.mozilla.org/u/otherrealm)\
**Post date:** [July 11, 2017, 3:42pm UTC](https://discourse.mozilla.org/t/capture-the-searchboxs-contents/16994/7 "2017-07-11T15:42:05Z")

</div>

Is this the one:  
[https://bugzilla.mozilla.org/show\_bug.cgi?id=1215064&GoAheadAndLogIn=1](https://bugzilla.mozilla.org/show_bug.cgi?id=1215064&GoAheadAndLogIn=1) ?

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [July 11, 2017, 3:47pm UTC](https://discourse.mozilla.org/t/capture-the-searchboxs-contents/16994/8 "2017-07-11T15:47:14Z")

</div>

Yep

(fill 20 char limit)
