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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:50:32+00:00 2026-06-17T10:50:32+00:00

Is it possible to transfer an object between background and content script within a

  • 0

Is it possible to transfer an object between background and content script within a browser extension?

I want my background script to handle my in-browser storage. My content script should trace user interactions and store them. Therefore I planed to use a singleton pattern to get an instance if my “abstract” storage engine from the background script to avoid syncing problems if an user records interactions and manages his data via the browser extensions’ UI at the same time.

My first try looks like this:

background script

var StorageEngine, _StorageEngine;

StorageEngine = (function() {
  var _instance;
  function StorageEngine() {}
  _instance = null;
  StorageEngine.getInstance = function() {
    return _instance != null ? _instance : _instance = new _StorageEngine;
  };
  return StorageEngine;
})();

_StorageEngine = (function() {
  function _StorageEngine() {}
  _StorageEngine.prototype.sayMyName = function(message) {
    return 'hello ' + message;
  };
  return _StorageEngine;
})();

content script

(function() {
  kango.invokeAsync('StorageEngine.getInstance', function(val) {
    var asd;
    if (val) {
      debugger;
    }
    asd = val.sayMyName('Alice');
    return kango.console.log(asd);
  });
}).call(this);

val isn’t undefined it’s an object if googles debugger is trustworthy but the function sayMyName is undefined.

  • 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-17T10:50:33+00:00Added an answer on June 17, 2026 at 10:50 am

    You can’t pass functions from background to content script because of browsers limitations, you can pass only JSON serializable data.

    Try to use storage in this way:

    // background script
    var storage = StorageEngine.getInstance();
    
    // content script
    kango.invokeAsync('storage.sayMyName', 'Alice', function(val) {
        kango.console.log(val);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is it possible to transfer a object from one application to another (in C#)?
I'm interested is it possible with PL/SQL block to transfer the content of a
Ok, Im wondering if it is possible to transfer the reference of the object
I want to implement a sort of transfer object pattern. So, i have a
I read it should be possible to transfer pixel data directly inside the GPU
is it possible to transfer files using vb.net? Cutting the files from a certain
is it possible to transfer files from one android phone to any other device
Is it possible to transfer files via an ODATA service? when there is a
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want
Possible Duplicate: How to do the vector of sets in C++? I want 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.