title: Javascript window.parent variable is never null
body: <p>As known, window.parent helps people get the parent window of the current one when several iframe are used.<strong>However,there should be an outermost window whose parent is null I think</strong>.</p>
  
  <p>I tried parent.parent.parent.parent... I thought I could get the root window when I found one of which parent is null. The amazing thing is that, no matter how many parent I used, the parent variable is never null.</p>
  
  <p>I have a condition as below.</p>
  
  <p>Website1 with domain: csm.mysite.com</p>
  
  <p>Website1-1 with domain: csmnew.mysite.com</p>
  
  <p>Website1-1 is in an iframe of Website1(they are not in the same domain)</p>
  
  <p>The same time, in Website1-1, there are many iframe(they are in the same domain)</p>
  
  <p><strong>I need to set/get a global variable for Website1-1</strong>, so I was using top. That really helps.</p>
  
  <p>However, <strong>when Website1-1 is in Website1, an error is always thrown because top variable(in Website1-1)  are referenced to Website1 and that is not valid for cross-domain policy</strong>. But what I really want is to set/get "top" variable of Website1-1.</p>
  
  <p>Then I was thinking if I could use parent.parent.parent.... to get outermost window of Website1-1 instead of using top which lets me get the wrong window.</p>
  
  <p>Back to the topic, why parent.parent.parent... is always null?</p>
  
  <p>By the way, does anyone have idea how to get the outermost window of "Website1-1"?</p>
  
  <p>Thanks alot</p>