2012-10-31 32 views
0

使用兒童瀏覽器。我的情況:關閉兒童瀏覽器轉發至html

  • 擁有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();"]; 
} 

回答

1

在您的onClose處理程序中將document.location設置爲index.html。應該那麼簡單。