gpt4 book ai didi

javascript - JavaScript中的Google YouTube API

转载 作者:行者123 更新时间:2023-12-03 06:26:45 24 4
gpt4 key购买 nike

我想使用我在网页上引用该脚本的Google文档,调用Google API来访问YouTube列表:

<script src="https://apis.google.com/js/client.js?onload=onClientLoad"></script>
<script>
function onClientLoad() {
alert(1);
}
</script>

永远不会调用onload函数,我不确定我缺少什么吗?!

我正在尝试将解决方案与API KEY一起使用,但是根据文档,我需要在onClientLoad调用后提供API Key。

最佳答案

找到了答案,这是一个诚实的错误!

需要更改脚本标签的顺序:

   <script>
function onClientLoad() {
alert(1);
}
</script>
<script src="https://apis.google.com/js/client.js?onload=onClientLoad"></script>

关于javascript - JavaScript中的Google YouTube API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25395182/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com