Web&H5

Initialization

Embed the following code within the head tag of the key business entry page

<script type="text/javascript">
	(function(){
              window._TDBotD = {}
              var botd = document.createElement('script'); 
              botd.type = 'text/javascript'; 
              botd.async = true;
              botd.src = 'Botd URL' + '?t=' + (new Date().getTime()/3600000).toFixed(0);
              var s = document.getElementsByTagName('script')[0]; 
              s.parentNode.insertBefore(botd, s);
	})();
</script>

Botd URL

Interface Signature

if(_TDBotD.sign){
  var fingalsign = _TDBotD.sign({
    path:'', // Only string types are supported
  })
  if(fingalsign.code == 0) {
    // Get the signature and use it
    var sign = fingalsign.sign // The final sign value
  } else {
    // Obtain error messages and status codes
    var msg = fingalsign.msg
    // Continue with the business logic. Here, the signature can be replaced by a blank character
    var errcode = fingalsign.code
  }
}else {
  // The interface protection is not initialized
}

Parameter

Assume https://baidu.com/user/profile?name=jacy&type=2 against doing interface protection, sample value may refer to:

Parameter nameTypeExample && Description
pathString'user/profile'

Status Code

codemsg
0success
2000failed, path is empty
2002path is not a string
3001not supported
3002initialization failed
3003sign failed