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 7081139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:52:57+00:00 2026-05-28T06:52:57+00:00

I am working on a firefox extensions that makes uses a lot of external

  • 0

I am working on a firefox extensions that makes uses a lot of external services, I want to have a .js file foreach of these external services hosted on my server and then load each one into the extension when needed.

These external js files are not “normal js” that would execute on a firefox window, they contain code that should be executed on the extension context, for example they need to make use of Components.classes["@mozilla.org/embedcomp/prompt-service;1"].

For example:

var myExtensionName = {
    init: function() {

    },

    service1_func: function() {

    }
}

I want to be able to load service1_Func from and external file and it should work the same as if it were hardcoded into the extension files. The reason I need this is because the service1_Func needs to be updated often and I don’t want to update the entire extension each time. I know this could create some security risks but the extension is not for distribution, but it will be used on more than 20 computers so this will be the easiest way for me to maintain it.

How could I achieve this?

English is not my main language, so I hope I explained myself well, please ask comment with questions if I need to clarify something.

  • 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-05-28T06:52:58+00:00Added an answer on May 28, 2026 at 6:52 am

    Warning: This is a security hole, don’t do this in an extension that other people are supposed to use!

    Use XMLHttpRequest to download the JavaScript file and Function constructor to “compile” it. Something like this:

    var request = new XMLHttpRequest();
    request.open("GET", "http://example.com/func1.js");
    request.addEventListener("load", function()
    {
      myExtensionName.service1_func = new Function(request.responseText);
    }, false);
    request.send();
    

    http://example.com/func1.js should contain the function body (without the surrounding function() {}).

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

Sidebar

Related Questions

I'm working on a rather huge Firefox extension that uses a lot of HTML
I have a working firefox extension that currently consists of a button. When I
I'm working on a FireFox extension that uses XMLHttpRequest to grab data from a
I'm working on a Firefox extension, in that I have a node which I
I'm working on a minimal Firefox extension that loads a web page into an
Good day everyone. I am working on a Firefox extension, and I want to
I am working in FireFox and I notice that a exception is thrown in
I have a set of small images which is working fine in Firefox but
Hi Javascript gurus, I have this Javascript code which is working fine on Firefox
I am working on a Firefox extension, and in that extension I am trying

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.