recaptcha - 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中引发了错误
不幸的是,在相同的情况下似乎没有任何答案。
解决方案
我找到了答案。
performance.now 被添加到 api.js 文件中,在我的另一个脚本中,使用了一个名为 performance 的变量。我更改了对问题进行排序的这个变量的名称。
也许这可以帮助别人!
推荐阅读
- typescript - 如何在 TypeScript 方法中发送 args 参数?
- json - 如何使用机器人框架更新/替换字典键类型的值是列表的字典/json文件中的值
- html - 即使不添加js,刷新html页面后页面也会自行滚动
- javascript - 如何打印选择标签对应值的名称?
- html - 无法输出包含“<”的 XSLT 变量
- javascript - 通过 REST API 对用户进行身份验证后,如何转到我的应用主页?
- c# - 如何基于 DatePicker 在网格视图中创建动态行
- java - 为什么我的子类对象总是空的,即使我在 Java 中有适当的构造函数?
- python - TensorFlow Object detection API 仅在帧的指定区域(在输入帧中定义 ROI)
- ios - 当夏令时结束时,在 Date 对象中添加/减少日期会返回错误的日期