title: Can't access parent page after reloading iframe
body: <p>To get access to the parent website from within an iframe, I use &quot;parent.document&quot;. Here is an example:</p>
  <pre><code>$('.my-plugin', parent.document).addClass('is-active');
  </code></pre>
  <p>This works perfectly fine.</p>
  <p>However, if I reload the iframe, it doesn't work anymore. The script loads, but fails whenever I run any &quot;parent.document&quot;-code, with this error in DevTools:</p>
  <pre><code>Uncaught TypeError: Cannot read property 'document' of null
  at HTMLDivElement.&lt;anonymous&gt; (VM28598 app.js:720)
  </code></pre>
  <p>From what I can see in DevTools, jQuery is loading on every reload from the iframe, and my guess is that some variables/triggers is still active after the first load? It looks like this in DevTools:</p>
  <pre><code>Script: jquery-3.5.1.min.js Initaiator: app.js:663 //after first load
  Script: jquery-3.5.1.min.js Initiator: VM28598 app.js:663 //after second load, etc
  </code></pre>