Web&H5

Initializing the SDK

Embed the following code in the head TAB of the business-critical entry page

<script type="text/javascript">
	(function(){
		window._fmOpt = {
			partner: 'your partner',
			appName: 'your appName',
			success: function(data) {
				console.log('blackbox: ', data)
			}
		};
		var fm = document.createElement('script'); 
    fm.type = 'text/javascript'; fm.async = true;
		fm.src = 'Base URL' + '?t=' + (new Date().getTime()/3600000).toFixed(0);
		var s = document.getElementsByTagName('script')[0]; 
    s.parentNode.insertBefore(fm, s);
	})();
</script>

Base URL

window._fmOpt Parameter Description

parametertypedescriberemarksamplerequired
partnerStringName of partnerDo not change at will (only letters, numbers, underscores)demoYes
appNameStringApp nameDo not change at will (only letters, numbers, underscores)demo_webYes
successFunctionSuccessful callbackOnce the blackbox is successfully fetched, the incoming callback is calledfunction(data){
console.log('blackbox:',data) }
Yes
timeoutIntegerCollection timeoutThe unit is ms. The default value is 2000. If all processes are not completed after the specified time, a demoted blackbox is obtained2000No
strictModeBooleanStrict modetrue: The current demoted blackbox is returned when demoted
false: Returns the cached last non-demoted blackbox (default) when demoted
falseNo
geolocationBooleanEnable geolocation collectiontrue: Enable
false: Disable (default)
falseNo

Get SDK Version

Obtain by source code file

/**
 * TrustDeviceJs Pro v3.8.11 - Copyright (c) TrustDeviceJs, Inc, 2024 (https://www.trustdecision.com/solutions/trustdevice)
*/

Obtain by code in runtime

window._fmOpt.sdkVersion