Turn a bend to think, if you can get the IFRAME inside the page information, then can not get the time, do not explain the form has been submitted it ~
We found that Baidu's bid on the lower right corner of the information, but also the use of this method to judge, we can refer to the next.
Example:
Test.html:
Copy Code code as follows:
<body style= "background: #a7a7a7;" >
<iframe id= "Testiframe" name= "Testiframe" ></iframe>
<form method= "POST" action= "http://www.test.com/testaction.php" target= "Testiframe" name= "Testform" >
<input type= "text" name= "dddd" ><input type= "Submit" value= "ddd" name= "submitbtn"/>
</form>
</body>
<script>
Document.testform.onsubmit = function () {
Document.testform.submitbtn.disabled = true;
Submitmonitor ();
}
function Submitmonitor () {
try{
var hash = document.getElementById (' Testiframe '). ContentWindow.location.hash;
SetTimeout (submitmonitor,100);
catch (e) {
document.getElementById (' testiframe '). src = "About:blank";
document.testform.submitbtn.disabled = false;
}
}
</script>
Note that the following code is Cross-domain, not under a domain name
testaction.php
Copy Code code as follows:
<?php
Sleep (5);
echo $_post[' dddd '];
?>
Disadvantages:
This drawback is also very obvious, if it is 404,403,500 errors, it will be mistaken for a successful submission.
Therefore, please note: This method is a research, pioneering thinking.
This is Baidu's judgment code.
Copy Code code as follows:
var sfmesstimes;
function Sfmesssubmitmonitor () {
try{
var hash = sf_mess_lib.getelement (sf_mess_frame_id). ContentWindow.location.hash;
Sfmesstimes + +;
if (Sfmesstimes > 50) {
alert (Sf_mess_msg.fail);
Sf_mess_lib.getelement (sf_mess_submit_id). Disabled = false;
for (var i = 0, L = sf_mess_cols.length i < l; i++) {
document.getElementById (Sf_mess_prefix + sf_mess_cols[i].idname). Disabled = false;
}
} else {
SetTimeout (sfmesssubmitmonitor,100);
}
catch (e) {
Sf_mess_lib.getelement (sf_mess_frame_id). src = "About:blank";
alert (sf_mess_msg.success);
Sf_mess_lib.getelement (sf_mess_submit_id). Disabled = false;
for (var i = 0, L = sf_mess_cols.length i < l; i++) {
var inputcfg = sf_mess_cols[i];
var Inputel = document.getElementById (Sf_mess_prefix + inputcfg.idname);
inputel.disabled = false;
Inputel.value = Filtinnertip (Inputcfg.innertip);
}
}
}