JQUERY - Waiting for window.location.href to Complete
<p>I am using the following line to kick off main.php which loads an iframe:</p>

<pre><code> window.location.href = '/main.php?token='+obj.token;
</code></pre>

<p>I need to wait for the iframe to complete loading so the $_GET token can be obtained.</p>

<p>After this I want to run the below line to remove the token from the command line:</p>

<pre><code>  window.history.pushState("object or string", "Title", "/new-url");
</code></pre>

<p>At the moment pushState always fires to quickly and then token is lost. 
Is there a way to delay this until the iframe is completely loaded?
Don't want to use a timer as it might not work sometimes.</p>

<p>thx</p>
