title: iOS - UIWebViewDelegate intercept javascript calls
body: <p>I'm using pretty much the this process oulined here to allow javascript to call objective c from my iPad app:</p>
  
  <p><a href="http://www.stevesaxon.me/posts/2011/window-external-notify-in-ios-uiwebview/" rel="nofollow">http://www.stevesaxon.me/posts/2011/window-external-notify-in-ios-uiwebview/</a></p>
  
  <p>My javascript code that I'm injecting into the page is:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;;
  window.external =
  {
  'Set_A': function(s) { document.location = 'qms://Set_A?param=' + s; },
  'Get_A': function(s) { document.location = 'qms://Get_A'; },
  
  'Set_B': function(s) { document.location = 'qms://Set_B?param=' + s; },
  'Get_B': function(s) { document.location = 'qms://Get_B'; },
  
  'Set_C': function(s) { document.location = 'qms://Set_C?param=' + s; },
  'Get_C': function(s) { document.location = 'qms://Get_C'; },
  
  'Get_Version': function(s) { document.location = 'qms://Get_Version'; }
  };
  &lt;/script&gt;;
  </code></pre>
  
  <p>And the javascript in the html code that calls the above method for initialization is:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  ...
  &lt;script type="text/javascript"&gt;
  
  Get_Version();
  
  Set_A(true);
  Set_B(false);
  Set_C(true);
  
  &lt;script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In the above html the only method that gets called in Objective C is the last method Set_C(true);  </p>
  
  <p>Thanks.</p>