In my application, I have a webview which loads up a page that contains both normal links and custom URL schemes, such as myapp://id=1234.
Right now, I am trying to trap the request within this function:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType{
NSLog(@"NSURLRequest = %@", [[request URL] absoluteString]);
}
Printing out the url as above gives me this:
http://localhost:8888/myapp://id=1234
Which is my localhost setup on MAMP with the custom URL appended to the URL.
I had hoped that I could use [request scheme] directly, but in this case now, it simply returns "http". Is there a way that I can handle custom URL schemes from within my own app?
At this point, I would like to be able to do the following:
- User is on the webview
- User taps the custom url link ( myapp://id=1234 )
- My app handles the custom url and directs the user to another page ( http://www.someotherpage.com/?id=1234 )
Thank you!