0

The Chrome browser supports multiple users (personas), so we can load a web page with different cookies and session data. This is working great, doing what I want. Now I wish for an extension installed on multiple user accounts to share information between users.

I cannot see how to do this, help please?

Details and Ideas:

By setting some cookies I can change some preferences of the target web page, to use some new features. Some features are different, but the core information should be the same. I wish to compare them via extension code.

By using the people feature of the chrome browser, ( personas ) I can load both old and new versions of our web page in chrome, and compare side by side.

I also have a chrome extension which scrapes a target web page, to pull out information like names, prices, information. This is also working great. I can manually check the scrape results of old or new versions of the page.

Now for the challenge : How can I compare scrape results between web pages loaded on different people (personas). Each "people" has the extension installed and running.

When I send an external message using the extension ID, only extensions on the same "people" receive it.

When I look at the background pages for each "people" extension, they are different. Setting a value for my Extension in one does not affect my Extension in the other.

// code in background page.
chrome.runtime.onMessageExternal.addListener(
    function(request, sender, sendResponse){
        console.log('background page was hit');
    });

// paste code in browser console.
chrome.runtime.sendMessage('id_here', {getTargetData: true},
    function(response) {
        console.log(response);
    });
Derek 朕會功夫
  • 92,235
  • 44
  • 185
  • 247
tom.g.c
  • 151
  • 1
  • 6
  • Have you tried using `SharedWorker` or `ServiceWorker` to communicate between browsing contexts? See [How can I load a shared web worker with a user-script?](https://stackoverflow.com/questions/38810002/) – guest271314 Sep 20 '17 at 23:37

1 Answers1

2

You can't share data between users on the client. This would allow your extension to potentially download all of a user's data and share it with another user.

That said, you can just push the data to a shared server and use that to compare (using HTTP or Websockets)

Doug
  • 14,387
  • 17
  • 74
  • 104