开发者

How to go back from Safari to UIWebView (iphone)

开发者 https://www.devze.com 2023-03-24 19:44 出处:网络
I really want to thank you all you guys first , I beganiOS programming learningseveral weeks ago ,and I havelearnt a lot from here these days,.

I really want to thank you all you guys first , I began iOS programming learning several weeks ago ,and I have learnt a lot from here these days,.

I have a UIWebView and loading some html content with "loadHTMLString" method, when i click hyperlinks in the UIwebView, It comforms the

-(BOOL)webView:(UIWebView *)webVie开发者_如何转开发w shouldStartLoadWithRequest:(NSURLRequest *)request 
 navigationType:(UIWebViewNavigationType)navigationType{ 
     if (navigationType == UIWebViewNavigationTypeLinkClicked) {
          [[UIApplication sharedApplication] openURL:[Request URL]];
          return NO;
     }
     return YES;
 }

to open a Safari.

My question is: Can I go back from the Safari to the UIWebView? how?


You can't get Safari to send the user back whenever you want, but one way to get back to your application is by creating a custom URL scheme (e.g. myapp://return, or whatever scheme makes sense to you), assuming that the web page the person is going to can have links that are intended to go back to your appliaction.

You can do this by registering that your application handles the URL scheme, and then processing the request appropriately when iOS tells you to. The Apple docs are fairly complete about this.

But if you want your application to be able to arbitrarily pull people back whenever you want, I don't think that's possible. Safari isn't under the control of anyone but Apple.

0

精彩评论

暂无评论...
验证码 换一张
取 消