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

  • Home
  • SEARCH
  • 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 9093615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:08:52+00:00 2026-06-16T23:08:52+00:00

Suppose I’m writing an extension that has two page mods that match different URL

  • 0

Suppose I’m writing an extension that has two page mods that match different URL patterns, which sometimes overlap. If both page mods share some JS libs, is there a way for my extension to only load those shared JS libs into a particular page once and have both page mods use them?

It appears to me that each page mod that an extension loads into a page gets its own global scope/namespace, which thwarts code sharing. However, the documentation seems to indicate that content scripts in the same page should be able to access each other directly:

Content scripts loaded into the same document can interact with each other directly as well as with the web content itself.

  • 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-16T23:08:53+00:00Added an answer on June 16, 2026 at 11:08 pm

    Content scripts loaded into the same document can interact with each other directly as well as with the web content itself, as long as they are loaded in via the same PageMod instance.

    This is why PageMod’s contentScriptFile option takes an array that can list several files, so that you can load in for example jQuery, and then use jQuery in your own separate code.

    What doesn’t work is having some shared scope for multiple PageMod instances, as each PageMod is loaded into a separate sandbox.

    A possible wqorkaround would be to route messages from separate PageMod instances via the SDK’s EventEmitter ‘port’ objects if you need simple communication.

    Unfortunately there is no way to share script resources between sandboxes as there is no shared cross-sandbox scope.

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

Sidebar

Related Questions

Suppose I have two pages: - page 1 uses jquery mobile and has a
Suppose that you have a 2D grid of cells, some of which are filled
Suppose you were writing a network-based WinForms application which is supposed to run in
Suppose we have two tables. Post and Comment. Post has many Comments. Pretend they
Suppose I've got two classes A and B such that B extends A ,
Suppose I have two different structures, Struct1 and Struct2. They both have different elements
Suppose I have an HTML page that looks something like this: <html><body> 00123 <input
Suppose that I have an n -sided loaded die, where each side k has
Suppose that I have to draw two faces of a 3D shape in a
Suppose I have a pure virtual method in the base interface that returns 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.