0

在 jQuery 文件本身中:

this.item_test = function(){
    $('body').css('background-color', '#00ff00');
    window.location = "/allCorrect/yes";
}

Out come 1(第 1 行证明 jQuery 工作正常):UIWebView绿色的背景(预期和正确)。

Out come 2(对于第 2 行,window.location 行):在委托方法中,预期(UIWebView *)webView shouldStartLoadWithRequest:值为。request.mainDocumentURL.relativePath/allCorrect/yes

我的问题:我没有得到“/allCorrect/yes”,而是得到了调用 jQuery 文件本身的以下文件位置:

“/Users/chiemekailo/Library/Application Support/iPhone Simulator/5.0/Applications/77BB3C4A-E99C-47C3-B2AE-F4DSDMFE84MFOEF/Documents/Unzipped/OPS”

4

1 回答 1

0

这将在不使用 jQuery 的情况下工作,所以我无法想象 jQuery 为什么或如何产生影响,但是您可以尝试使用此方法而不是使用位置更改(不使用 jQuery),它也会触发 webViewShouldStartLoadWithRequest 以查看它是否适用于 jQuery。

iFrame = document.createElement("IFRAME");
iFrame.setAttribute("src", "/allcorrect/yes");
document.body.appendChild(iFrame); 
iFrame.parentNode.removeChild(iFrame);
iFrame = null;
于 2012-05-23T05:12:18.760 回答