I Want to stop WebPage Loading of UIWebView while passing it another URL for Loading.
我想停止WebPage加载UIWebView,同时传递另一个URL加载。
2 个解决方案
#1
5
You should implement:
你应该实现:
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType
method of UIWebViewDelegate
Protocol and return NO
for all url you don't want to load.
UIWebViewDelegate协议的方法,并为您不想加载的所有网址返回NO。
Example:
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
if ([[inRequest URL] isEqual:someMyUrl]) {
return YES;
}
return NO;
}
#2
1
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];
#1
5
You should implement:
你应该实现:
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType
method of UIWebViewDelegate
Protocol and return NO
for all url you don't want to load.
UIWebViewDelegate协议的方法,并为您不想加载的所有网址返回NO。
Example:
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
if ([[inRequest URL] isEqual:someMyUrl]) {
return YES;
}
return NO;
}
#2
1
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];