谁能告诉我如何在 jhipster 中允许跨站点脚本编写以便解决警告吗?
A Parser-blocking cross site (i.e. different jsapi:22 eTLD+1) script, https://www.google.com/uds/?file=elements&v=1&packages=transliteration, 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
以及同一消息多次出现引用不同的 Google 脚本。
最佳答案
您收到的警告是由于您包含 Google Transliterate API这种方式可能会导致网络连接速度慢的设备上的用户体验不佳。
在您网站的脚本中的某个位置,您将看到如下所示的一行:
document.write('<script src="https://www.google.com/uds/?file=elements&v=1&packages=transliteration"></script>');
一个 document.write
中可能有多个脚本或者它们可能被分散到多个调用中。这可能不是对document.write
的调用中唯一的事情。 .
要删除此警告,您需要移动所有 <script>
调用 document.write
之外的标签.
参见this post了解更多详情。
关于java - 通过 document.write() 调用跨站点脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45185682/