title: Android Webview Javascript Injection
body: <p>I'm attempting to inject javascript into a page I load in a webview. For example, I am placing a value into a given text box by override 'onPageFinished' within a custom WebViewClient class:</p>
  
  <pre><code>public class MyAppWebViewClient extends WebViewClient {
  
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, String url) {
          view.loadUrl(url);
          return true;
      }
  
      @Override
      public void onPageFinished(WebView view, String url)
      {
          super.onPageFinished(view, url);
          view.loadUrl("javascript:" +
              "document.getElementById('elid').value = 'texthere';");
      }
  }
  </code></pre>
  
  <p>This works correctly when browsing the website, and clicking links, but when I press the back button, the java/javascript does not appear to be correctly executed (the text box is not properly filled out.</p>
  
  <p>The onPageFinished function is called when the back button is pressed, but it seems to be executing the javascript on the current page, not on the page being returned to.</p>