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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:03:13+00:00 2026-06-15T19:03:13+00:00

I am writing a Firefox add-on which uses context-menu and page-mod modules. This add-on

  • 0

I am writing a Firefox add-on which uses context-menu and page-mod modules.

This add-on adds a new menu item to the context menu when the context is input control. When the menu item is clicked, I request to the server to get some data and pushes the result to the content script which page-mod is using.

For some reason, onAttach function is not getting called. There are no errors in the console. I am not sure why it is not getting called. Here is what I am doing.

var data = require("self").data,
    contextMenu = require("context-menu"),
    request = require("request").Request;

var workers = [];
var pageMod = require("page-mod");
pageMod.PageMod({
    include: '*',
    contentScriptWhen: 'ready',
    contentScriptFile: [data.url("jquery-1.8.2.min.js"), data.url("varnam.js")],
    onAttach: function(worker) {
        console.log("onAttach");
        workers.push(worker);
        worker.on("detach", function() {
            var index = workers.indexOf(worker);
            if (index >= 0) workers.splice(index, 1);
        });
    }
});

Any help to fix this issue would be great. Full code is available here.

  • 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-15T19:03:14+00:00Added an answer on June 15, 2026 at 7:03 pm

    When the url pattern begins with (or is just) an asterisk, then it is matched against urls with a scheme of http, https and ftp.

    Since your test page is in the data directory its url scheme is resource. And that’s why PageMod is not triggered.

    You can add the test page url by doing something like

    var varnam = pageMod.PageMod({ 
    // blah blah
    });
    
    varnam.include.add(data.url("test.html"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a webapp ( Firefox-compatible only ) which uses long polling (via jQuery's
I stumbled upon this add-on which Ajaxifies parts of its target website. https://addons.mozilla.org/en-US/firefox/addon/51789 I
I'm writing a browser add-on (Chrome and Firefox) which, in a nutshell, does some
I am writing a Firefox extension, which is doing two things (for the context
I'm writing a Firefox extension (add-on) to allow users to annotate any page with
I am writing a Firefox add-on that adds little icons next to all the
I am quite new to writing Firefox Add-Ons, still, I got to a point
I am writing a FireFox add-on that displays webpages from my server as control
As I was writing a Firefox add-on using the Add-on SDK , I noticed
When writing filters for the Firefox Add-On 'Adblock Plus' you can write rules to

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.