EzhNotes

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"
           extends="chrome://browser/content/id_to_extend">
    <handlers>
      <handler event="event to override">
      <![CDATA[
        your code here;

        return false;
      ]]></handler>
    </handlers>
  </binding>  

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: