0

使用儿童浏览器。我的情况:

  • 有一个 index.html 文件和 test.html。
  • 去test.html
  • 从 test.html 启动 Childbrowser
  • 我按下左上角的“完成”按钮
  • Childbrowser 正在关闭并从我的应用返回到最后打开的页面,在本例中为 www/test.hml

我想将 Childbrowser 重定向/转发到我的 index.html 电话间隙?我该怎么做?

js文件:

// 当用户选择“完成”按钮时回调 // 从本机调用

ChildBrowser._onClose = function()
{
    window.plugins.childBrowser.onClose();
};

.m 文件中的代码片段:

- (void)closeBrowser
{

    if (self.delegate != nil) {
        [self.delegate onClose];
    }
    if ([self respondsToSelector:@selector(presentingViewController)]) {
        // Reference UIViewController.h Line:179 for update to iOS 5 difference - @RandyMcMillan
        [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
    } else {
        [[self parentViewController] dismissModalViewControllerAnimated:YES];
    }
}

- (IBAction)onDoneButtonPress:(id)sender
{ 
    [self closeBrowser];
    NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]];
    [self.webView loadRequest:request];
}

另一个 .m 文件:

- (void)close:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url
{
    [self.childBrowser closeBrowser];
}

- (void)onClose
{
    [self.webView stringByEvaluatingJavaScriptFromString:@"window.plugins.childBrowser.onClose();"];
}
4

1 回答 1

1

在您的 onClose 处理程序中,将 document.location 设置为 index.html。应该就这么简单。

于 2012-10-31T14:53:59.520 回答