Recaptcha v3 问题 - performance.now 不是函数

Recaptcha v3 Issue - performance.now is not a funtion

我刚刚开始实施 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.gstatic.com/recaptcha/api2/v1541614764654/recaptcha__en.js which is called in https://www.google.com/recaptcha/api.js

中抛出错误

不幸的是,对于相同的场景似乎没有任何答案。

我找到了答案。

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

也许这可以帮助其他人!