웹 페이지의 반환 수신

1327 단어
바로 html 중의history입니다.go(-1)
html 코드


function goBack()
{
   window.history.go(-1);
}


이때 웹 감청은 바로 간다
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
if (navigationAction.navigationType == WKNavigationTypeBackForward) {
       NSLog(@"goback");
   }
  decisionHandler(WKNavigationActionPolicyAllow);
}

goback 인쇄
웹 페이지의 기록
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
if (navigationAction.navigationType==WKNavigationTypeBackForward) {                 
        if (webView.backForwardList.backList.count>0) {                                  
            WKBackForwardListItem * item = webView.backForwardList.currentItem;         
            for (WKBackForwardListItem * backItem in webView.backForwardList.backList) { 
                [webView goToBackForwardListItem:[webView.backForwardList.backListfirstObject]];
            }
        }
    }
decisionHandler(WKNavigationActionPolicyAllow);
}

좋은 웹페이지 즐겨찾기