I meet a problem which weview load link that will get nil
(<a target='_blank' href='http://wangdazhi.blogger.com'> )
- (WebView*)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request
{
[[sender mainFrame]loadRequest:request];
return sender;
}
After much investigation,I found that the problem was caused by '_blank'.
you can use this method to solve this problem
[webView setPolicyDelegate:self];
- (void)webView:(WebView *)webView decidePolicyForNewWindowAction:(NSDictionary *)actionInformation
request:(NSURLRequest *)request
newFrameName:(NSString *)frameName
decisionListener:(id<WebPolicyDecisionListener>)listener
{
[[myWeb mainFrame] loadRequest:[NSURLRequest requestWithURL:[request URL]]];
}
No comments:
Post a Comment