iOS – UIWebViewDelegate intercept javascript calls

I’m using pretty much the this process oulined here to allow javascript to call objective c from my iPad app:

http://www.stevesaxon.me/posts/2011/window-external-notify-in-ios-uiwebview/

  • Is this possible to apply the alternative icon to the iOS application?
  • Check direction of scroll in UIScrollView
  • UIImagePickerControllerDelegate Methods Not Called When Delegate Not UIViewController
  • How do I get my pre-populated Default.realm file onto a device?
  • Making image positioned on textbox clickable in case of ipad (Creating HTML5 Search input type for iOS)
  • Number of days between two NSDates
  • My javascript code that I’m injecting into the page is:

    <script type="text/javascript">;
    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'; }
    };
    </script>;
    

    And the javascript in the html code that calls the above method for initialization is:

    <html>
    <body>
    ...
    <script type="text/javascript">
    
    Get_Version();
    
    Set_A(true);
    Set_B(false);
    Set_C(true);
    
    <script>
    </body>
    </html>
    

    In the above html the only method that gets called in Objective C is the last method Set_C(true);

    Thanks.

    Solutions Collect From Internet About “iOS – UIWebViewDelegate intercept javascript calls”