如何在防止“无法在 'Document' 上执行 'write'”错误的同时防止加载外部资源?

How do I prevent loading of an external resource while preventing the “Failed to execute 'write' on 'Document'” error?

我想延迟加载外部资源,直到我的网页加载完毕,所以我尝试了很好的“延迟”运算符

<script src="//assets.adobedtm.com/aaabbbcccddd/satelliteLib-680156eb19277c7ad2206ff3fac1c250f6d6214c.js" defer></script>

我这样做的原因是,如果外部资源不存在或联系该网站时出现问题,我不希望我的页面呈现速度变慢或被阻止。这是我无法控制的来自 Adob​​e 的外部文件。不幸的是,在 Chrome 上添加此指令会在控制台中出现以下错误...

Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.

有谁知道我可以在最后加载此文件而不会在资源未加载时阻止页面呈现并防止上述错误的方法吗?

我想我找到了解决方案:Postscribe。它似乎可以解决问题:

<body>
  <div id="blah"><!-- document.write() content gets inserted here --></div>
  <script>
    document.addEventListener('DOMContentLoaded', function() {
      postscribe('#blah', '<script src="http://url/to/script.js"><\/script>');
    });
  </script>
</body>

不再有 Chrome 错误!


编辑:为了避免混淆,我已经删除了我原来的、无效的答案(它使用了这个 huge script loading guide 中的代码)。