首页 > 解决方案 > Recaptcha v3 问题 - performance.now 不是一个函数

问题描述

我刚刚开始实施 Google Recaptcha v3,与文档中的完全一样。

<script src='https://www.google.com/recaptcha/api.js?render=MY_API_KEY'></script>
<script>
    grecaptcha.ready(function() {
        grecaptcha.execute('MY_API_KEY', {action: 'homepage'})
            .then(function(token) {

            });
    });
</script>

但我不断收到这个错误;

Uncaught TypeError: performance.now is not a function

在https://www.google.com/recaptcha/api.js中调用的https://www.gstatic.com/recaptcha/api2/v1541614764654/recaptcha__en.js中引发了错误

不幸的是,在相同的情况下似乎没有任何答案。

标签: recaptcharecaptcha-v3

解决方案


我找到了答案。

performance.now 被添加到 api.js 文件中,在我的另一个脚本中,使用了一个名为 performance 的变量。我更改了对问题进行排序的这个变量的名称。

也许这可以帮助别人!


推荐阅读