I started to study the WebViewerJavascript-Tutorial and constructed the app discribed in http://appinventor.mit.edu/explore/ai2/webview-javascript
Meanwhile I developped a version without error message, but there is no reverse text (I hit “opowoj” in the text label and got “opowoj” back with a TIMOUT message.
<!doctype html>
<head>
<title>WebView Javascript Processor</title>
</head>
<body onload="processJavascript();">
<b>This page includes a javascript function that reverses text.</b>
<p>The javascript function incorporates a special App Inventor feature called <i>window.AppInventor.getWebViewString()</i>, which allows App Inventor apps to communicate with the WebViewer component's internal processing of javascript.
<p>This simple example shows how to use the <i>window.AppInventor.getWebViewString()</i> function to pass data to and from the WebViewer component, and thereby an App Inventor app.
<script>
var result = new Date().toString();
var appInventorInput = window.AppInventor.getWebViewString();
function processJavascript() {
if (appInventorInput.length > 0) {
document.write( "WebView InputString received FROM app:
" + appInventorInput );
result = appInventorInput.split("").reverse().join("");
document.write( "<p/>WebView InputString sending BACK TO app:<br/>" +
result );
} else {
document.write( "No WebView InputString set by app at: <br/>" + result );
}
window.AppInventor.setWebViewString( result );
}
</script>
</body>
</html>
If you are asking for help, I recommend you to make it as easy for others to be able to help you …
You probably will get more feedback then…
which means in your case post a screenshot of your relevant blocks as well as the Javascript code directly into your post…
To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc… this takes time, and most people will not do that…
Thank you.
Hello Taifun,
so I deleted all blocks containing the clock elements.
But I have no idea, what’s a “WebViewStringChange event” is. I can’t work simultanously on two projects. I cancelled the line with the function in the html file and the last bracket.
Hello dear supporters,
thank you very much for the heavy box of usable hints. I’ll have plenty to do testing them all. My focus at the moment is using a javascript for getting an app result via WebViewer…