Start a new topic

HtmlDrawable.evalJavaScript() doesn't work


We use HtmlDrawable to build GeoObject, and defined functions in <script> of our HTML file. but when We call those function by evalJavaScript(), it just doesn't work, without any response.

here is our HTML file: 


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width = 120, user-scalable = 0">
        .background {
            position: absolute;
            left: 0;
            width: 120px;
            background-color: rgba(255,255,255,0.8);
            border-radius: 100px;
            display: flex;
            flex-direction: column;
            justify-content: space-around;
            align-content: center;
        p {
            margin: 0;
            text-align: center;
    <div class="background">
        <p class="title" id="title">标签</p>
        <p class="distance" id="distance">距离</p>
        var title = document.getElementById('title');
        var distance = document.getElementById('distance');
        function refreshDistance(di) {
            if (di < 10) {
            	distance.innerHTML = "<10 m";
            } else {
            	distance.innerHTML = di.toFixed(1) + " m";
        function init(ti, di) {
            title.innerHTML = ti;


 and here we call the init():


var html = new AR.HtmlDrawable({
			uri: "./js/TagStyles/default.html"
		}, 4, {
		viewportWidth: 120
var cmd = "init(\"" + + "\", 20);";



by the way, evalJavaScript("alert(\"probe\")") also doesn't work, i wonder how to get the debug info in the context of our HtmlDrawable

1 person has this problem

Hi flybike,

Could you please provide some further details:
  • Which version of the SDK are you using?
  • Are you using any of our Extensions (Titanium, Cordova, Xamarin, Unity)? If yes, which version are you using?
  • What device does this happen with (os Version and model)?




Hi Eva,

I used version 6.0.1 in Android and no extensions were used. My device is HUAWEI NTS_AL00, which uses Android 6.0 with some modification, but I don't think Webview was changed cause everything of web view looks same as other devices.



thank you for reporting this issue, we were able to fix it and it will be included in the next release.

Best Regards,


Login or Signup to post a comment