Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7866307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:21:18+00:00 2026-06-03T00:21:18+00:00

In my Firefox add-on using the Add-on SDK, I’m trying to include two library

  • 0

In my Firefox add-on using the Add-on SDK, I’m trying to include two library files from the data directory in main.js, and it’s not working.

I have the following directory structure:

data
-- jquery-latest.min.js
-- pagemodscript.js
-- mylibrary.js

lib
-- main.js

pagemodscript.js uses jQuery, and that works (using contentScriptFile).

I also want to use jQuery and mylibrary.js in main.js, but that’s not working.

Various things I’ve tried result in error messages “ReferenceError: [class in mylibrary.js] is not defined”, “ModuleNotFoundError: unable to satisfy: require(mylibrary.js)”, and “has no authority to load”.

I tried moving mylibrary.js and copying jquery-latest.min.js to lib, but that resulted in one of those error messages.

What’s the best way to set this up?

Note: the reason I want to use jQuery in main.js is because – after an event generated by pagemodscript.js – I want main.js to add a div to the current page in which it will display a list of objects it created from another event generated by pagemodscript.js. Is the better practice to have pagemodscript.js create those objects and create the div? In that case, this would work: I’d load mylibrary.js into pagemodscript.js using contentScriptFile. In that case, pagemodscript.js would be creating objects of the class defined in mylibrary.js, and that doesn’t seem as good a design as the way I’d prefer to do things.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:21:20+00:00Added an answer on June 3, 2026 at 12:21 am

    I also want to use jQuery and mylibrary.js in main.js

    That won’t do you any good. jQuery expects to run in a window and works with the DOM. Extension files execute in an entirely different environment – there is no window to access and some typical window functions are unavailable. Also, extension files simply aren’t allowed to access the DOM, all web page access has to happen in content scripts.

    I want main.js to add a div to the current page

    You should send a message to your content script (pagemodscript.js) and let it create the div for you. That’s how it works with the Add-on SDK.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Add-on Builder Beta (Firefox) and I'm trying to do something like this:
As I was writing a Firefox add-on using the Add-on SDK , I noticed
I'm working on developing a Firefox add-on using the Add-on SDK . I changed
I'm trying to manipulate the XUL elements in the Firefox add-on page using the
I'm working on porting a Chrome extension to Firefox using the Firefox Add-on SDK.
I have already coded most of a Firefox add-on using the Add-on SDK API.
I am building a simple Firefox extension using the Add-on SDK 1.0. Scouring the
I am trying to get page title on every page using new Firefox add-on
I'm using the Firefox Add-on Builder and here is what I have so far:
I am writing a FireFox add-on that displays webpages from my server as control

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.