Google说我必须把这些文件放在文档的头上:
<script src="https://www.gstatic.com/firebasejs/6.2.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.2.0/firebase-firestore.js"></script>有6-8个这样的脚本。
关键是,在加载html之前,我不需要它们,直到稍后。
html body是否等待加载所有这些?head上,而不是在我的html之后发布于 2019-07-23 04:45:42
我的html主体是否等待加载所有这些?
如果您使用异步分离脚本,您的html主体不要等待
为什么谷歌明确建议把它们放在头上,而不是在我的html之后?
我认为firebase建议将其添加到https://firebase.google.com/docs/web/setup中
<body>
<!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->
<!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->
<script async src="/__/firebase/6.3.1/firebase-app.js"></script>
<!-- Add Firebase products that you want to use -->
<script async src="/__/firebase/6.3.1/firebase-auth.js"></script>
<script async src="/__/firebase/6.3.1/firebase-firestore.js"></script>
</body>发布于 2019-07-23 04:32:52
您可以将async标记附加到这些脚本上,以防止它们阻塞整个页面。
发布于 2019-07-23 04:46:26
https://stackoverflow.com/questions/57156721
复制相似问题