Something goes wrong because the image not shows on screen, only the title and the word Bild!
How to solve this problem? Perhaps I use wrong methods?
I Try this code below build on the B4J-Server example.
Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
ws = WebSocket1
Dim m As Map
Dim base As String = File.ReadString(File.DirAssets, "Dynamic.html")
Dim sHtm As String
m.Initialize
'm.Put("ImageID",File.GetUri(File.DirApp , "viewcamper.png")) ' no diffrent
m.Put("ImageID",File.DirApp & "/viewcamper.png")
sHtm = WebUtils.ReplaceMap(base, m)
Log (sHtm)
MainDiv.SetHtml(sHtm) 'no image showsDim m As Map
Dim base As String = File.ReadString(File.DirAssets, "Dynamic.html")
Dim sHtm As String
m.Initialize
'm.Put("ImageID",File.GetUri(File.DirApp , "viewcamper.png")) ' no diffrent
m.Put("ImageID",File.DirApp & "/viewcamper.png")
sHtm = WebUtils.ReplaceMap(base, m)
Log (sHtm)
Index.html like this
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta content="text/html;charset=windows-1252" http-equiv="Content-Type" />
<title>Camper Viewer</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="index.css" />
<script src="/b4j_ws.js"></script>
</head><title>Camper Viewer</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="index.css" />
<script src="/b4j_ws.js"></script>
<body>
<h1>Web Images Viewer Exampel (WebSocket)</h1>
<p id="plog"></p>
<div id="maindiv">
</div>
<script>
$( document ).ready(function() {
b4j_connect("/dynamic/ws");
});
</script>
</body><p id="plog"></p>
<div id="maindiv">
</div>
<script>
$( document ).ready(function() {
b4j_connect("/dynamic/ws");
});
</script>
</html>
And Dynamic.html as below
<p><img align="middle" alt="Bild" src="$ImageID$" style="width: 900px; margin-right: 0px;" /></p>