I’m packaging a mobile website (over the network) in PhoneGap and would like to intercept links pointing to PDF’s and open them using the ChildBrowser plugin. Is it 1: possible to trigger ChildBrowserfrom native code (I’ve already determined which links to intercept) and 2: is AppDelegate.m, .shouldStartLoadWithRequest() the right place to do it? And in that case: 3: how to correctly call ChildBrowser from native code?
I’ve tried this admittedly naive approach:
return [self exec:@"ChildBrowserCommand.showWebPage",
[url absoluteString]];
but it only resulted in an error along the lines of ...'NSInvalidArgumentException', reason: '-[AppDelegate exec:]: unrecognized selector sent to instance.
(PS: I’m aware this approach isn’t ideal practice, but this project is only priced for 2 days work)
If you added (Child Browser) plugin classes in plugin folder then you have to play with the appDelegate.m file,
#import "ChildBrowserViewController.h"For example your html file has following html/javascript code, like this
window.location="http://xyz.com/magazines/magazines101.pdf";To execute this url in Child Browser, you need to modify native
shouldStartLoadWithRequest:method for request url which contain pdf extension files.thanks,
Mayur