2014-06-27 92 views
1

我正在通過XDK製作HTML5移動應用程序。我有一些表格,我在網站上使用Captcha驗證。在我的預期中,針對移動應用程序的垃圾評論不會製作任何場景。有沒有人看到任何垃圾評論的移動應用程序?您是否認爲我需要在移動應用表單中使用驗證碼驗證碼,或者不要打擾用戶?需要爲移動應用表單使用驗證碼驗證?

回答

0

,以防止這兩個網站和混合應用垃圾評論和垃圾郵件機器人的最佳方式是通過JS或jQuery的動態創建的形式,而不是把形式直接視圖(HTML代碼)。通過這種方式,您不需要將Captcha放在機器人上就可以保護它。下面是與jQuery創建形式的樣本代碼:

// Make THE FORM tag 
var $form = $("<form/>", { 
    appendTo : $("#contactFormSection"), 
    class : "col-xs-12 col-sm-11", 
    id  : "contactForm", 
    submit : AJAXSubmitForm 
}); 

//MAKE A HIDDEN INPUT 
$("<input/>",{ 
    type  : "hidden", 
    name  : "flag", // Needed for serialization 
    value  : "5", 
    appendTo : $("#nameSection"), 
    on   : {  // Yes, the jQuery's on() Method 
    /* 
    input : function() { 
     console.log(this.value); 
    } 
    */ 
    } 
}); 

//Make Name INPUT 
$("<input/>",{ 
    type  : "text", 
    class  : "formContact", 
    id   : "exampleInputName2", 
    name  : "name", // Needed for serialization 
    placeholder : "Your Name", 
    appendTo : $("#nameSection"), 
    on   : {  // Yes, the jQuery's on() Method 

    } 
}); 

//MAKE EMAIL INPUT 
$("<input/>",{ 
    type  : "email", 
    class  : "formContact", 
    id   : "exampleInputEmail1", 
    name  : "email", // Needed for serialization 
    placeholder : "Your Email", 
    appendTo : $("#emailSection"), 
    on   : {  // Yes, the jQuery's on() Method 

    } 
}); 

//MAKE TEXTAREA 
$("<textarea/>",{ 
    class  : "formContact-text", 
    rows  : "3", 
    name  : "msg", // Needed for serialization 
    placeholder : "Your message", 
    appendTo : $("#msgSection"), 
}); 

//submit the form 
function AJAXSubmitForm(event) { 
    event.preventDefault(); // Prevent Default Form Submission 
    // do AJAX instead: 
    var serializedData = $(this).serialize(); 
    $.ajax({ 
    url: "Your server API URL", 
    type: "POST", 
    data: serializedData, 
    dataType: 'json', 
    success: function (data) { 
     // log the data sent back from PHP 
     if(data.status){ 
     $('#confirmation').modal('show'); 
     } else{ 
     $('#errorMsg').modal('show'); 
     } 
    } 
    }); 
} 
1

垃圾評論發生在移動和桌面網站或應用程序上。常用的文本驗證碼驗證有助於解決此問題。

當談到移動應用程序時,很難在本機應用程序中自動提交數據。原因部分是由於無法編寫惡意的外部腳本來發現源代碼中的元素並調用表單提交。此外,移動應用程序必須購買(免費或付費)並安裝在物理設備或模擬器中。

驗證碼是比較理想的移動應用:sliderCAPTCHAimageCAPTCHAmotionCAPTCHARingCAPTCHANuCAPTCHA