title: How to set Javascript properties in Android webview
body: <p>I am building an Android application that loads a web application in to a web view. When a user visits the web application in a browser a pop up asking if they want to bookmark the page appears. </p>
  
  <p>For the native app I want remove this.</p>
  
  <p>For iPhone I was able to do this:</p>
  
  <pre><code>    [webView stringByEvaluatingJavaScriptFromString:@"AppConfig.showBookmarkPrompt=false;"]; 
  </code></pre>
  
  <p>For Android I tried this:</p>
  
  <pre><code>@Override
      public void onPageFinished(WebView view, String url) {
          view.loadUrl("javascript:(function(){"+
                  "AppConfig.showBookmarkPrompt=false;})()");
      }
  </code></pre>
  
  <p>The Android version doesn't work. I presume that the javascript is being run after the bookmark popup has been shown. I don't really know why the iPhone version does works and not the Android. </p>
  
  <p>There are many other ways I can achieve my goals but I am wondering if anybody can explain why the iPhone method works and if there is something similar in Android. I have been reading about it through Google searches but it is still not entirely clear to me. </p>
  
  <p>Thanks for any help I get.</p>
  
  <p>EDIT</p>
  
  <p>The problem was for Android I was passing a function in JavaScript where I should have just set the property like this: view.loadUrl("javascript:AppConfig.showBookmarkPrompt=false;");</p>
  
  <p>There must be some difference in the way it is executed that I don't quite understand.</p>