title: Do content scripts run in the same isolated world, or in separate isolated worlds?
body: <p>I'm reading through the Chrome docs trying to learn how to create an extension and am struggling to understand how to share data between content scripts.</p>
  
  <p>Let's say I have three scripts bundled with my extension:</p>
  
  <pre><code>jquery.js
  script1.js
  script2.js
  </code></pre>
  
  <p>I need <code>script1.js</code> and <code>script2.js</code> to use jQuery, and each script needs to be able to read and write global variables ala <code>window.foo = 'bar'</code>. </p>
  
  <p>The scripts also add content to the DOM that is event driven, so the global variables they read/write need to be persistent as long as the tab is open. </p>
  
  <p>For example, <code>script1.js</code> might add a button to the page that when clicked runs a function defined in <code>script1.js</code>, which in turn sets a global variable and then runs a function in <code>script2.js</code> which then uses that variable (just an example).</p>
  
  <p><a href="https://developer.chrome.com/extensions/content_scripts" rel="nofollow">The content script docs</a> say:</p>
  
  <blockquote>
    <p>However, content scripts have some limitations. They cannot: </p>
    
    <ul>
    <li>... </li>
    <li>Use variables or functions defined by their extension's pages </li>
    <li>Use variables or functions defined by web pages or by other content scripts</li>
    </ul>
  </blockquote>
  
  <p>Does this mean an extension's content scripts cannot interact with each other at all, or is it saying that content scripts from <em>different</em> extensions can't interact with each other?</p>
  
  <p>In other words, do all of an extensions content scripts run in the same isolated world, or in separate isolated worlds?</p>