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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:22:43+00:00 2026-05-29T10:22:43+00:00

This one’s perhaps a duplicate of variable not recognized inside contentscript under the same

  • 0

This one’s perhaps a duplicate of “variable not recognized inside contentscript” under the same section. I got part of my query solved there from the answer to that question. Yeah, I understand that

The content script context is entirely disconnected from the addon script context. Content scripts are run in the context of the document, while addon scripts aren’t.

But does that mean we can never access a variable in the content script context in the addon script context? If by any means we could access them, please do let me know. My requirement needs objects to be sent as parameters to functions in another script(data/utilities.js) and possibly get the returned object. There was no difficuty in doing the former but am stuck with the latter cos of the aforementioned context problem. I am able to return the value from the content script context but unable to access the same in the addon context. Can anyone please help me out with a little example of this?

PS I could as well discussed it there but I read that I shouldn’t as this ain’t a discussion forum.

  • 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-29T10:22:44+00:00Added an answer on May 29, 2026 at 10:22 am

    You cannot get direct access to variables in the content script from the addon script context directly. You can pass the variable back to the add-on from the content script using

    self.port.emit('send-some-var', some_var)

    You would then receive the variable’s value in the add-on script by listening for the same event:

    worker.port.on('send-some-var', function(data) { console.log(data) })

    The main limitation however is that the data being passed through must be JSON-serializable, so you could not have a complex object with methods, etc. Only data.

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

Sidebar

Related Questions

This one is a case of not doing your homework.:-) Apart from dynamic loading
This one's got me stumped. Usually with a little CSS juggling here and there
This one has got me stumped. I'm deploying a Rails 3 app to Slicehost
This one is tough to explain inside the title. What I have going on
This one is probably a simple one, but I could not find an example
This one I really think is not possible to solve through XSLT, so that
This one is strange... I have a server at home that's part of my
This one may seem like a simple question, but it's really got me scratching
This one is driving me nuts. It’s got to be something simple and stupid
This one got me the other day. What would you expect the following 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.