title: How to programatically remove sandbox attribute from an iframe with javascript
body: <p>I didn't think this was possible, however, i found this quote:</p>
  
  <blockquote>
    <p><a href="https://developer.mozilla.org/en-US/docs/HTML/Element/iframe" rel="noreferrer">"It is strongly discouraged to use both allow-scripts and allow-same-origin at the same time, as that allows the embedded document to programmatically remove the sandbox attribute."</a></p>
  </blockquote>
  
  <p>My iframe needs to have a sandbox, but only when I am browsing in certain URLs where the embedded browsing context tries to navigate (load) content to the top-level browsing context (Jump out of frame...)</p>
  
  <p>On other pages the sandbox needs to be removed entirely, as it wont allow me to browse away from a site with a different origin... </p>
  
  <blockquote>
    <p>The frame attempting navigation is sandboxed, and is therefore disallowed from navigating its ancestors.</p>
  </blockquote>
  
  <p>Programatically changing the sandbox with : </p>
  
  <pre><code>document.getElementById("frame").sandbox = "";
  </code></pre>
  
  <p>...doesnt work either as this still places restrictions... Therefore, i need to somehow remove the attribute entirely, how would i go about doing this?</p>