title: Is there a way to load a whole URL under the same domain before redirecting to a blank window to wait its loading using JavaScript?
body: <p>Say I have two pages:</p>
  <p><code>index.html</code> and <code>detail-product.html</code> as the index page and a product detail page.</p>
  <p>In the index page, I have a link to the product page:</p>
  <p><code>&lt;a target=&quot;_self&quot; href=&quot;detail-product.html&quot;&gt;Product Details&lt;/a&gt;</code></p>
  <p>If the user clicks the link, the browser would open a blank page as the product page loading.</p>
  <p>I want to make this experience more smooth. Is it possible to do something that would allow the index page to hold and wait until the product page loads, then open it in a very fast speed.</p>
  <p>For instance, I would do something like this:</p>
  <pre><code>$('a').click(function(){
    var targetLink = $(this).attr('href');
    var loadSuccessCallback = function(){
      window.href = targetLink;
    }
    holdLoading(loadSuccessCallback);
  })
  function holadLoading(cb) {
    // do the loading thing
    // .....
    // if the page is loaded, then call &quot;cb&quot;.
  }
  </code></pre>