我最近開始使用Google的新方法Recaptcha--他們的新隱形Recaptcha。我意識到這個版本的實現有點不同,因爲您將recaptcha屬性直接附加到您的提交按鈕上,然後調用Google的recaptcha api並開始驗證過程。我所有的工作都很好,但是我遇到的一個主要問題是「受recaptcha保護」徽章定位。隱形Recaptcha徽章定位問題
將我的提交按鈕添加到我的提交按鈕後,我開始看到我的屏幕右側的徽章。根據其他網站,這個徽章應該只是一個方形的recaptcha標誌,直到它被徘徊,然後它應該滑出我最初在我的網站上看到的大矩形。
下面是我看到我的網站後,實施隱形recaptcha後形象。
這裏是包含的ReCaptcha提交按鈕代碼屬性:
<button class="btn btn-primary btn-block g-recaptcha" data-sitekey="key"
data-callback="submitsecure" data-badge="bottomright" type="submit">Get Started</button>
注:其它data-badge
選項,如inline
和bottomleft
原因相同的定位問題。
的包含按鈕形式的代碼:
<form action="processjoin.php" method="post" id="signupform" style="padding-top:10px;padding-bottom:10px;max-width:50%;">
<h2 class="sr-only">Login Form</h2>
<div></div>
<div class="illustration"><i class="icon ion-ios-pulse-strong"></i>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="text" name="name" placeholder="Your Name" class="form-control" id="name" />
</div>
<div class="form-group">
<input type="text" name="username" placeholder="Username" class="form-control" id="username" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="email" name="email" placeholder="Email" class="form-control" id="email" />
</div>
<div class="form-group">
<input type="password" name="password" placeholder="Password" class="form-control" id="password" />
</div>
</div>
</div>
<div class="form-group">
<button class="btn btn-primary btn-block g-recaptcha" data-sitekey="6LfdMhkUAAAAAHl-LXZm_gPP1g-UX0aWt8sMR4uW" data-callback="submitsecure" data-badge="bottomright" type="submit">Get Started</button>
</div>
<a href="#" class="forgot">
<div></div>Already have an account? Sign in.</a>
</div>
</form>
我遇到兩個問題與此驗證碼徽章:
- 這個徽章上glitched其邊框的外/邊框類型的東西
- 它也沒有定位部分屏幕上直到徘徊,就像它應該是。在以任何方式與鼠標交互之前,我都看到了完整的矩形。我應該看到方形的標誌,直到我將它懸停在它上面,然後滑出整個矩形。
基本上,我需要弄清楚如何正確定位它,以便它從屏幕外滑入,就像它應該的那樣,並且正好包含在邊框內。
谷歌Chrome瀏覽器開發工具告訴我,這些都是徽章股利,所產生的當前屬性加載窗口時:
我真的很感激任何幫助,您可以提供!如果我錯誤地認爲徽章是必需的,請糾正我的錯誤,然後我會用CSS強制刪除徽章,但是,恐怕這可能會導致驗證碼驗證過程混亂並違反Google的政策。
一旦從表單中刪除徽章,g-recaptcha-response將不會附加到帖子請求中,除非您在表單中手動創建名爲「g-recaptcha-response」的隱藏輸入字段。 – Silentdrummer