Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何异步加载google recaptcha?_Javascript_Html_Frontend_Recaptcha - Fatal编程技术网

Javascript 如何异步加载google recaptcha?

Javascript 如何异步加载google recaptcha?,javascript,html,frontend,recaptcha,Javascript,Html,Frontend,Recaptcha,在实施谷歌无验证码后,我的网站页面加载速度明显变慢 这个问题来自于 我怎样才能用javascript加载这个页面,并在页面加载后显示验证码 我试过: function loadCaptcha(){ var div = document.createElement('div'); div.className = 'row'; div.innerHTML = ""; div.innerHTML += "<script src='https://www.

在实施谷歌无验证码后,我的网站页面加载速度明显变慢

这个问题来自于


我怎样才能用javascript加载这个页面,并在页面加载后显示验证码

我试过:

function loadCaptcha(){

    var div = document.createElement('div');

    div.className = 'row';

    div.innerHTML = "";
    div.innerHTML += "<script src='https://www.google.com/recaptcha/api.js'></script>";
    div.innerHTML += "<form action='' method='post''><div align=\"center\" id='centercaptcha' class=\"g-recaptcha\" data-sitekey=\"***\"></div><br><button name='Claim faucet' value='Claim faucet' id='faucet-button'>Claim faucet</button></form>";

    document.getElementById('center').appendChild(div);

    //document.getElementById("loading").style.display = "none";
}
函数loadCaptcha(){
var div=document.createElement('div');
div.className='行';
div.innerHTML=“”;
div.innerHTML+=“”;
div.innerHTML+=“您有两个选项:

  • 将脚本标记移到底部
  • 您有两个选择:

  • 将脚本标记移到底部

  • 按照Google的指示在
    -块中使用
    异步延迟

    <script src="https://www.google.com/recaptcha/api.js" async defer></script>
    

    按照Google的指示在
    -块中使用
    异步延迟

    <script src="https://www.google.com/recaptcha/api.js" async defer></script>
    
    
    
    底部是指标记吗?请澄清底部,我是指HTML代码中最底部的部分,其中
    标记不会破坏HTML规范。页脚应该可以工作。底部是指标记吗?请澄清底部,我是指HTML代码中最底部的部分,
    标记不会破坏HTML规范。页脚你会工作的。