October 30, 2009

Override default firefox behavior from an extension

Filed under: programming — Tags: — alexezh @ 8:27 pm

There are number of ways to replace the default behavior for the firefox. If you want to replace a method on the object, following code will do the trick

eval("object.method =" + object[method].toString().replace('{', '{ your code here ;'));

In case if code is event handler for XUL object, you have to create a handler with the same event and return false to prevent further processing

  <binding id="my-id"
      <handler event="event to override">
        your code here;

        return false;

Blog at WordPress.com.