Skip to content

Commit

Permalink
open website in same window
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0c committed Dec 22, 2014
1 parent 2637b0b commit 0c56b7a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Pod/Classes/M2DWebViewController/M2DWebViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ typedef NS_ENUM(NSUInteger, M2DWebViewType) {
M2DWebViewTypeAutoSelect
};

@interface M2DWebViewController : UIViewController <WKNavigationDelegate, UIWebViewDelegate>
@interface M2DWebViewController : UIViewController <WKUIDelegate, WKNavigationDelegate, UIWebViewDelegate>
{
NSURL *url_;
UIBarButtonItem *goForwardButton_;
Expand Down
22 changes: 17 additions & 5 deletions Pod/Classes/M2DWebViewController/M2DWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ + (UIImage *)m2d_arrowIconWithDirection:(M2DArrowIconDirection)direction size:(C

@end


////////////////////////////////////////////////////////////////////////////////


@interface M2DWebViewController ()

@property (nonatomic, copy) UIImage *backArrowImage;
Expand Down Expand Up @@ -166,7 +162,18 @@ - (void)setSmoothScroll:(BOOL)smoothScroll
}
}

#pragma mark - WKWebViewDelegate
#pragma mark - WKUIDelegate

- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
{
if (!navigationAction.targetFrame.isMainFrame) {
[webView loadRequest:navigationAction.request];
}

return nil;
}

#pragma mark - WKNavigationDelegate

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
{
Expand Down Expand Up @@ -292,6 +299,11 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
[self.navigationController.toolbar setItems:items];
}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
return YES;
}

#pragma mark -

- (void)goForward:(id)sender
Expand Down

0 comments on commit 0c56b7a

Please sign in to comment.