title: Greasemonkey & global variables
body: <p>I'm noob with JavaScript and Greasemonkey and I'd like to write a simple script.</p>
  
  <p>I know that Greasemonkey wraps your code with an anonymous function so your variables won't exist after leaving the current page. However, I need a global variable. 
  I tried to use the unsafeWindow and window objects something like this:</p>
  
  <pre><code>if (window.myVar == undefined) {
     window.myVar = "myVar";
  }
  </code></pre>
  
  <p>If I refresh the page the condition's value is always true.</p>
  
  <p>Is there a way to use global variables with Greasemonkey?</p>