我有一个带有情节提要和NavigationViewController的应用程序。在一页上,我有一个webView对象,其中包含一个网上商店。在此视图中,我不得不隐藏顶部的栏,因为我想将此位置用作我自己的html5-bar。

现在我的问题。是否可以通过webView中的javascript触发(隐藏)后退按钮?

E D I T

我从解决方案链接尝试了这段代码

- (void)viewDidLoad
{
    [super viewDidLoad];
    [[self navigationController] setNavigationBarHidden:YES animated:YES];
    [self.browser loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString:@"http://www.mywebshop.com/mobile/"]]];
}


-(void) webView:(UIWebView *)browser shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
    if ( [[[inRequest URL] scheme] isEqualToString:@"callback"] ) {

        NSLog(@"Catched Succesfull");
    }
    NSLog(@"NOT Catched");
}

但是它没有抓住事件。没有日志记录。我误会了吗?

最佳答案

您可能对history.back() http://www.w3schools.com/jsref/met_his_back.asp感兴趣

关于javascript - native IOS应用程序从Web浏览器javascript接收数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15488340/

10-12 00:19
查看更多