gpt4 book ai didi

javascript - 在我的网站上添加YouTube订阅按钮,但出现此错误

转载 作者:行者123 更新时间:2023-12-03 06:17:00 25 4
gpt4 key购买 nike

因此,我一直在尝试使用YouTube API V3给我的以下代码在测试网站上添加订阅按钮:

<script src="https://apis.google.com/js/platform.js"></script>

<div class="g-ytsubscribe" data-channelid="UCzfStpfCASIjJNK2xMNdJiw" data-layout="full" data-count="default"></div>

但是,当我加载页面时,它给了我这些错误:
> Failed to execute 'postMessage' on 'DOMWindow': The target origin
> provided ('file://') does not match the recipient window's origin
> ('null'). cb=gapi.loaded 0:49

> Failed to execute 'postMessage' on 'DOMWindow': The target origin
> provided ('file://') does not match the recipient window's origin
> ('null'). cb=gapi.loaded 0:48

任何帮助,将不胜感激!

最佳答案

刚刚测试了您的代码段,对我来说效果很好。我所做的只是将您的交换给我进行测试,但仍然有效。
我猜想您与您的代码有冲突。
因此,请在首次调用时将脚本标签放在顶部。如果不起作用,请尝试停用其他脚本,以查看其中存在冲突的脚本。

关于javascript - 在我的网站上添加YouTube订阅按钮,但出现此错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42760889/

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