Open Mobile Safari from a Link in a WebView

前端 未结 5 1717
不思量自难忘°
不思量自难忘° 2020-11-30 10:00

Is there a URI scheme to open Mobile Safari to a specific URL?

e.g.,

Open Google in Safari         


        
5条回答
  •  醉梦人生
    2020-11-30 10:26

    You can also use the webkit javascript bridge https://github.com/marcuswestin/WebViewJavascriptBridge

    This allows you to send messages from javascript to xcode. I use this to close the webview from the html page:

    self.bridge = [WebViewJavascriptBridge bridgeForWebView:self.webView handler:^(id data, WVJBResponseCallback responseCallback) {
                NSLog(@"Received message from javascript: %@", data);
                if ([data isEqual:@"closewin!"])
                    [self dismissModal];
            }];
    

    but you could also use this to jump to safari or anything you want

提交回复
热议问题