2017-08-15 66 views
0

我認爲我的情況有點奇怪...我有一個經過Google Recaptcha驗證的表單。提交按鈕被禁用,直到recaptcha已被交互,使用數據回調和一些JS。我只是使用Safari瀏覽器在我的iOS設備上嘗試了我的網站,然後我進行了Recaptcha驗證,並且出現了一個綠色檢查,就像平常一樣。然後當我滾動時,表單所在的容器div消失了,然後整個表單變灰了。它似乎落後於網站背景。Google Recaptcha在iOS上執行奇怪的事情Safari瀏覽器

這是錯誤的截圖:

enter image description here

所以,我很困惑,至少可以說。我在搜索過程中沒有發現任何類似的問題。形式與PHP集成,下面的代碼:

<?php 
if (isset($_REQUEST['email'])) { 
    if ($_SERVER["REQUEST_METHOD"] === "POST") { 
    $recaptcha_secret = "my_secret_key_was_here"; 
    $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$_POST['g-recaptcha-response']); 
    $response = json_decode($response, true); 

    if ($response["success"] === true) { 
     $to = "[email protected]"; 
     $subject = "Contact Form"; 
     $firstname = $_REQUEST['firstname']; 
     $lastname = $_REQUEST['lastname']; 
     $email = $_REQUEST['email']; 
     $comments = $_REQUEST['comments']; 

     $message = "First Name: \t"; 
     $message .= $firstname; 
     $message .= "\n"; 
     $message .= "Last Name: \t"; 
     $message .= $lastname; 
     $message .= "\n"; 
     $message .= "Email: \t"; 
     $message .= $email; 
     $message .= "\n"; 
     $message .= "Message: \t"; 
     $message .= $comments; 
     $message .= "\n"; 

     mail($to, $subject, $message, "From:" . $email); 
     header("Location: sent.html"); 
    } else { 
     header("Location: failed.html"); 
    } 
    } 
} else { 
    ?> 

的其他人打開了頁面的HTML,顯示的頁面,如果條件不具備。這裏是我的腳本:

$(document).ready(function() { 
    $('#submitbutton').prop("disabled", true).attr('title', "Please check the catchpa before submitting the form"); 
}); 

var enableBtn = function() { 
    $('#submitbutton').prop("disabled", false).attr('title', "Submit"); 
} 

這是我的HTML表單:

<form method="post" action="new.php"> 

     <label for="firstname">First Name:</label> 
     <input name="firstname" required type="text" /> 

     <label for="lastname">Last Name:</label> 
     <input name="lastname" required type="text" /> 

     <label for="email">Email Address:</label> 
     <input name="email" required type="email" /> 

     <label for="comments">Message:</label> 
     <textarea name="comments" required></textarea> 

     <div class="center-captcha"> 
     <div class="g-recaptcha" data-sitekey="my_site_key_was_here" data-callback="enableBtn"></div> 
     </div> 

     <button class="send-button" id="submitbutton">Submit</button> 
    </form> 

任何幫助將不勝感激。

+0

從網站作爲一個臨時的解決辦法只是刪除了的Recaptcha。該表格現在可以在移動設備和電腦上正常工作有趣的......明天回來 – empoweredev

回答

相關問題