Android Question HTML Code inside WebView

M.G.R

Member
Licensed User
Longtime User
Hello,
i need to run that code inside webview to control with the "Try Again" button for try to refresh the page.
* the
B4X:
webview1.LoadHtml("<html></html>")
code give me syntax error

HTML:
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Error</title>
</head>

<body style="transition: background 1.5s;">

<div align="center">
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAAInUlEQVR4AezBgQAAAACAoP2pF6kCAAAAAAAAAAAAAACK2bn32CrrO47j3+MphSH0ciiLyBh2RqfoJNoN5CbRYGGMAIsmDJiyqEQzt3CZyy4yZcGwDBlzk11EQNiQ3mTLnMnMmDjigIWqgQoERnFCxMCgLVQcvZ3nvTSMEJryfH/P0+fp6a/n9/78D+T34nBOnxN+3E8ZOUjsSzGBR/gJm3mT/RynkRY8WmjgQw7xDm+wjif5GqNIIbZM6OrupxWojI0gySieYAvHCNL7bOJxbidpP4DJ8RMLwSC+QRUNdKWPeYU55NkPoB1/tAQDmMdfaSOqmvkLDzPAcgDl+KMiuI0XaCSOGlnNCJsBlOOPgGAybxB3bzLDGgD9+CMk+DLVdFfVlNoJoB9/OIISttPd/Z2x9gHoxx+coIh1eGSmlxlsE4B+/MEJEuwkk51mnm0AZQARElzLITLb3yi2CSCHyl5H0MBMewDaCSp6HQGsJMcWgDgIhvQAgh0MtQVASFLeCwmOMcIWACFJWeQEB8l0dYyxBUBIsrmbCdIcoIwfMZtxXE+KXBLkkmI4tzKeeSxnC/tooyv9l2m2AAhJXu4mgv38jKnkI+jLZzo/Zy8e4WrlPlsAhCSbYiY4yJPcgITYdSzhEGFqptQCgNgIrvk/QStljEe6uNFsoJWgfcJYCwBiJNjDaoYjEe06fk0TwWpgpC0AwlX8PhhBBjYk8EO/Ywy2BaCd4Hc9nkAYyx6CtI2kLQDtBBstIEiymCbMW2kPQDvBBgsI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x98DqAcQAAACAEAAAAgAAAEAIAAABACALjgHc/1yTAJzAAAAAElFTkSuQmCC" style="padding-top:60px; max-width:90%;"/>
    <b><p style="color:#FFFFFF;font-family:roboto;padding:20px;font-size:30px;">
        Oops, Check Your Connection!
    </p></b>
    <button onclick="history.go(-1);" style="
    font-size: 40px;
    font-family: roboto;
    border: 5px solid #FFFFFF;
    background-color: rgba(255, 255, 255, 0);
    color: #ffffff;"><b>TRY AGAIN</b></button>
</div>

<script>
    const randomColor = () => '#' + Math.random().toString(16).substr(-6)
    const changeColor = () => document.body.style.backgroundColor = randomColor()

    setInterval(() => {
      changeColor()
    }, 1500)

    // start color animation as soon as document is ready
    document.onreadystatechange = () => {
      if (document.readyState === 'complete') {
        changeColor()
      }
    }
</script>
</body>
</html>
 
Top