title: Android Web-view Error I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError:
body: <p>I have a web-service In that I have added bar-code reader for android</p>
  
  <p>So with the Help of JavaScript I am calling my bar-code reader from web-view</p>
  
  <p>So for that <a href="http://android-er.blogspot.in/2011/10/call-javascript-inside-webview-from.html" rel="nofollow noreferrer">I followed this</a></p>
  
  <p>and designed on server side...
  I have Given this  </p>
  
  <p><strong>at JavaScript</strong></p>
  
  <pre><code>    function mybarcd() {
             MyApp.mybarcdt();
          }
  
      function actfromAnd(msg){
             document.getElementById("brcd").value = msg;
         }
  
  
      at HTML/PHP
  
      &lt;div class="data"&gt; 
              &lt;input id="brcd" type="text" value=""/&gt;
              &lt;button type="button" onClick="mybarcd()"&gt;SCAN&lt;/button&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>On Android side</strong>
  <strong><em>In webview</em></strong></p>
  
  <pre><code>    webView.addJavascriptInterface(new WebAppInterface(this), "MyApp");
  </code></pre>
  
  <p><strong>and new js interface</strong></p>
  
  <pre><code>    @JavascriptInterface
      public void mybarcdt() {
  
                  IntentIntegrator intentIntegrator = new IntentIntegrator(Main_A.this);
                  intentIntegrator.setBeepEnabled(true);
                  intentIntegrator.setOrientationLocked(true);
                  intentIntegrator.setPrompt("Scan Barcode");
                  intentIntegrator.initiateScan();
              }
  
  
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
          if (result != null) {
              if (result.getContents() == null) {
                  Log.d("ScanActivity", "Cancelled scan");
                  Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show();
  
              } else {
  
                  Log.d("ScanActivity", "Scanned");
  
                  String bcval = result.getContents();
                  if (android.os.Build.VERSION.SDK_INT &lt; 19) {
                      webView.loadUrl("javascript:actfromAnd(\""+bcval+"\")");
                  }else{
                      webView.evaluateJavascript("javascript:actfromAnd(\""+bcval+"\")", null);
                  }
                  System.out.println("javascript:actfromAnd(\""+bcval+"\")");
  
              }
          } else
              super.onActivityResult(requestCode, resultCode, data);
      }
  </code></pre>
  
  <p>My Problem is that Its working fine in a single Html/PHP file with Js on same page or separate page I have tested its scanning and Updating the value in input box...</p>
  
  <p>But its not working since I have using multiple pages or frame in one webview...
  its missing JS value... How ever form server its opening scanner at on-click... but after scanning the value is not passing to the input box with JS I am getting this error.....</p>
  
  <pre><code>I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError: actfromAnd is not defined", source:  (1)
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>1)I hava Tried this in Static Page with JS in side that PHP/HTML page<br>
  2)I also tried with same in a static Page with JS seperate page<br>
  On the above two conditions its worked fine</p>
  
  <p>But In my web-service I have Given Same JS file which is running successfully in Static page I have a single JS file for My Webservice and Static page its working fine in static but not working in MY webservice live.. How ever JS is loading Because on click its wokring from that JS and its opening Camera
  But responce after scanning its not going to web input</p>
  
  <p>I understand that I am getting Error Because...<br></p>
  
  <blockquote>
    <p>In my Live Page I have a MainMenu Inside that menu when I select a application its loading in <code>iframe</code> So my Android Activity responce after scanning Is pinging to that Mainmenu page But for menu there is no Js  function named <code>actfromAnd</code> So I am getting Error... </p>
  </blockquote>
  
  <p>Here I can't give URL of that particular page(<code>iframe</code>) Because of depending on the menus it will change I can Give Only Login or MainMenu link directly.but not for  a particular page inside the menu</p>
  
  <p>Can Any one suggest me on this kind...</p>