Using jQuery 1.5 in your Firefox extension : A quick guide

Talk about add-ons and extension development.
lightfox
Posts: 1
Joined: November 15th, 2011, 2:59 pm

Re: Using jQuery 1.5 in your Firefox extension : A quick gui

Post by lightfox »

Hey there,

well, i tried all solutions here, and I *still* can't manage to load jQuery...

i tried studgeek's snippet, but it sends an error here:

Code: Select all

readURLSync: function(url) {
            var data = myExtensionJQ.ajax({
                     url: url,
                     async: false,
                     dataType: "text",
                     mimeType: 'text/plain; charset=x-user-defined'
                  }).responseText;
            return data;
         },


"myExtensionJQ" isn't defined, and there is not a single clue about where this should come from, especially since the code is called before jquery.

I also tried the original scenario 2 above, without much luck: wnd.jQuery is null.

I find it quite amazing it's so tedious to find out how to do something this simple...
archmisha
Posts: 2
Joined: April 20th, 2012, 6:45 am

Re: Using jQuery 1.5 in your Firefox extension : A quick gui

Post by archmisha »

Great post Ziink,

I am trying to follow your lead but getting the following error:
TypeError: wnd.jQuery is undefined
When importing the jquery

The only difference is that i got a button that starts my process and not on every page load.
Up until now I used var doc = content.window.document; in my extension, so now i tried to pass content.window to the loadjQuery plugin.
Also doc.defaultView doesnt work

Any idea?
kashiif
Posts: 7
Joined: September 15th, 2011, 3:59 am

Re: Using jQuery 1.5 in your Firefox extension : A quick gui

Post by kashiif »

archmisha wrote:I am trying to follow your lead but getting the following error:
TypeError: wnd.jQuery is undefined
When importing the jquery


I am also having the same issue. I need JQuery to manipulate content document (Scenario 2 of the original post).

Has anyone been able to do this?
archmisha
Posts: 2
Joined: April 20th, 2012, 6:45 am

Re: Using jQuery 1.5 in your Firefox extension : A quick gui

Post by archmisha »

No sorry, still no solution. I tried to PM him. Still waiting for a reply
The_Rave
Posts: 95
Joined: January 25th, 2005, 8:36 am
Location: Germany

Re: Using jQuery 1.5 in your Firefox extension : A quick gui

Post by The_Rave »

@studgeek

Without your ajax function nobody (excluding professional devs) will get your example working.

var data = myExtensionJQ.ajax({....
Post Reply