title: Unsafe JavaScript attempt to initiate navigation for frame with URL
body: <p>This is a bit complicated, please bear with me. 
  Website A has a iframe that contains website B and website B has a iframe that contain website C. </p>
  
  <p>There is a button on website C, when clicked, I want to refresh url of website B. below is the javascript called to do the refresh of website B from website C, which is in an iframe</p>
  
  <pre><code>function url_update(id){
     var host = 'https://websiteb.com ';
     var myHost = host.split('/'); 
     if (id != "" &amp;&amp; myHost != ""){
      try {
          if (id.substring(0,1) != '/'){
              id = '/' + id;
          }
          var dft_url = myHost[0] + '//' + myHost[2] + id;
          window.parent.location.href = dft_url;
      } catch(e){alert("Cannot go to the desired url location: " + dft_url);}
     } 
   }
  </code></pre>
  
  <p>but when the line "window.parent.location.href = dft_url;" gets executed, I received the following error: </p>
  
  <pre><code> Unsafe JavaScript attempt to initiate navigation for frame with URL  
   'https://websiteB.com' from frame with URL
   'https://websiteC.com'. The frame attempting navigation is 
    neither same-origin with the target, nor is it the target's parent or    
    opener.
  </code></pre>
  
  <p>I don't understand why this happening and how to fix it. Any help will be appreciated. </p>
  
  <p>I did some research, most claimed this is an origin problem, but if I take out website A, meaning only have website B with an iframe that contains website C, then the above code works. Even though they have different domains</p>