Firefox addon to do something everytime a user hits Enter in the address bar

I'm trying to write an extension that monitors every time someone types hits enter when using the address bar. The steps would be something along the lines of

  1. User types in a bunch of text in the address bar and hits Enter
  2. My addon springs to life and receives what the user typed in
  3. My addon then decides what to do with the string the user typed in.

I get the url in step 2 by using var url = window.location.href. I also have most of step 3 written out already. The only probably I can't seem to figure out is how to monitor every tab to watch for when the user hits return.

I'm really new to Javascript, but regardless of that, any information would be appreciated.

This is what my myaddon.xul file looks like:

<overlay id="sample" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://myaddon/content/myaddon.js" />
<textarea id="urlbar" ontextentered="return myaddon_URLBar(param);" />
</overlay>

Answers


I think the following link would help. You need to implement Progress Listeners, they allow extensions to be notified whenever some events happen associated with the document. You can also extend this to multiple tabs. Please try the link

https://developer.mozilla.org/en/Code_snippets/Progress_Listeners#Example.3a_Notification_when_the_value_in_Address_Bar_changes

Hope it helps :)


Need Your Help

Thinking Sphinx wild card search and fuzzy operator not found

ruby-on-rails full-text-search thinking-sphinx

I am trying to implement a full text for set of models. I heard the power of sphinx in its indexing speed and search time. But wild card searches and nearest word match ( Levenshtein distance) are ...

MVC Web form without database

asp.net-mvc vb.net email

I'm in the process of refitting a website that I'd previously built using ASP.net with VB in the code-behind, into MVC with VB so that it's more responsive to different screen sizes and device type...