2012-05-03 99 views
2

我正在將jqueryMobile html文件加載到webview中,並正確觸發了webViewDidFinishLoad事件。但是,當您選擇載入另一個HTML文件內容的已加載jqMb文件的導航按鈕時,事件不會被觸發!如何捕捉它?謝謝iOS + jqueryMobile加載html文件時無法捕獲webview事件

+0

您可以使用jQuery Mobile的暴露JavaScript事件:http://jquerymobile.com/demos/1.1.0/docs/api/events.html。請參閱'pageinit',它是jQuery Mobile的'document.ready'。 – Jasper

+0

當按鈕被按下時,我可以在jqueryMobile上正確捕獲事件!但如何觸發本地webview事件? shouldStartLoadWithRequest – Jaume

+0

使用假javascript調用解決,widow.location =「localFuction」。然後 - (BOOL)webView:(UIWebView *)如果if([[[request URL] absoluteString] hasPrefix:@「localFunction」]){{return NO;}}將觸發webView shouldStartLoadWithRequest。希望這會有所幫助 – Jaume

回答

1

使用假javascript調用,widow.location = "localFuction"解決。

然後,- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest被觸發,如果([[[request URL] absoluteString] hasPrefix:@"localFunction"]) { Return NO;

希望這有助於

+0

我知道這是一箇舊的帖子,但你在哪裏/如何調用'window.location =「localFunction」'? – adamdehaven