html property
String
html
Implementation
String get html {
return """
<!DOCTYPE html><html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="HandheldFriendly" content="true">
<script src="https://www.gstatic.com/firebasejs/${firebaseVersion}/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/${firebaseVersion}/firebase-auth.js"></script>
<script type="text/javascript">firebase.initializeApp(${jsonEncode(firebaseConfig)});</script>
<style>
html, body {
height: 100%;
${invisible ? 'padding: 0; margin: 0;' : ''}
}
#recaptcha-btn {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
border: 0;
user-select: none;
-webkit-user-select: none;
}
</style>
</head>
<body>
${invisible ? '<button id="recaptcha-btn" type="button" onclick="onClickButton()">Confirm reCAPTCHA</button>' : '<div id="recaptcha-cont" class="g-recaptcha"></div>'}
<script>
var fullChallengeTimer;
function onVerify(token) {
if (fullChallengeTimer) {
clearInterval(fullChallengeTimer);
fullChallengeTimer = undefined;
}
window.flutter_inappwebview.callHandler('verifyHandler', token);
}
function onLoad() {
window.flutter_inappwebview.callHandler('loadHandler');
firebase.auth().settings.appVerificationDisabledForTesting = ${appVerificationDisabledForTesting};
${languageCode != null ? 'firebase.auth().languageCode = \'${languageCode}\';' : ''}
window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier("${invisible ? 'recaptcha-btn' : 'recaptcha-cont'}", {
size: "${invisible ? 'invisible' : 'normal'}",
callback: onVerify
});
window.recaptchaVerifier.render();
}
function onError() {
window.flutter_inappwebview.callHandler('errorHandler');
}
function onClickButton() {
if (!fullChallengeTimer) {
fullChallengeTimer = setInterval(function() {
var iframes = document.getElementsByTagName("iframe");
var isFullChallenge = false;
for (i = 0; i < iframes.length; i++) {
var parentWindow = iframes[i].parentNode ? iframes[i].parentNode.parentNode : undefined;
var isHidden = parentWindow && parentWindow.style.opacity == 0;
isFullChallenge = isFullChallenge || (
!isHidden &&
((iframes[i].title === 'recaptcha challenge') ||
(iframes[i].src.indexOf('google.com/recaptcha/api2/bframe') >= 0)));
}
if (isFullChallenge) {
clearInterval(fullChallengeTimer);
fullChallengeTimer = undefined;
window.flutter_inappwebview.callHandler('fullChallengeHandler');
}
}, 100);
}
}
${invisible ? """
window.addEventListener('message', function(event) {
if (event.data === 'recaptcha-setup')
{
document.getElementById('recaptcha-btn').click();
}
});""" : ''}
</script>
<script src="https://www.google.com/recaptcha/api.js?onload=onLoad&render=explicit&hl=${languageCode ?? ''}" onerror="onError()"></script>
</body></html>""";
}