通过 document.write 警告调用阻止解析器的跨站点(即不同的 eTLD+1)脚本

A parser-blocking, cross site (i.e. different eTLD+1) script, is invoked via document.write warning

当我查看我网站的控制台时,我在 Chrome 中看到以下警告:

A parser-blocking, cross site (i.e. different eTLD+1) script, https://secure.trust-
provider.com/trustlogo/javascript/trustlogo.js, is invoked via document.write. 
The network request for this script MAY be blocked by the browser in this or a 
future page load due to poor network connectivity. If blocked in this page load, 
it will be confirmed in a subsequent console message. See
 https://www.chromestatus.com/feature/5718547946799104 for more details.

触发此事件的是 Sectigo 的信任徽标。您也可以在他们的 site 上看到此警告。

此外,我使用的代码与他们在我的页面上提供的代码相同:

<script type="text/javascript"> //<![CDATA[
  var tlJsHost = ((window.location.protocol == "https:") ? "https://secure.trust-provider.com/" : "http://www.trustlogo.com/");
  document.write(unescape("%3Cscript src='" + tlJsHost + "trustlogo/javascript/trustlogo.js' type='text/javascript'%3E%3C/script%3E"));
//]]></script>
<script language="JavaScript" type="text/javascript">
  TrustLogo("https://sectigo.com/images/seals/sectigo_trust_seal_lg_2x.png", "SECEV", "none");
</script>

谁能帮忙解决这个警告?谢谢。

不要使用 document.write 调用脚本,而是尝试正常包含它:

<script type='text/javascript' src='https://secure.trust-provider.com/trustlogo/javascript/trustlogo.js'></script>

<script type='text/javascript'>
  TrustLogo("https://sectigo.com/images/seals/sectigo_trust_seal_lg_2x.png", "SECEV", "none");
</script>