Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Well, the solution [NOT a production quality solution] posted by Sebastian worked, but I couldn’t confirm if CPU load would cause this issue. I generated a lot of background load on the iOS host and couldn’t reproduce this issue. </p> <p>Upon further investigation, the rendering issue seems to be a side effect of iOS shell canceling the navigation. Once the navigation is canceled by the iOS shell, the rendering engine probably take that as not needing to render more UI [basically doesn’t render anything for a small period].</p> <p>One way to fix this would be to send commands to iOS shell as hash (<code>#</code>) parameters instead of a URL. This way iOS shell will get the commands and doesn’t need to cancel the navigation. This approach seems to work in the test code below. So, if window.location is set to location1, it alerts “At: 1” and element e2 has no value. And if the window.location is set to location2, it alerts “At: 0” and element e2 has the value.</p> <p>@Kevin, could you confirm that you were canceling the navigation on iOS host when this behavior happened.</p> <h2><strong>Test Code:</strong></h2> <p><strong>Javascript:</strong></p> <pre><code> var location1 = "myApp://Test"; var location2 = "#myApp://Test"; $("#change").live("click", function (e) { var element = document.getElementById("e1"); window.location = location1; var i = 0; element.innerHTML = "At: " + i; window.__intervalHandle = window.setInterval(function () { var html = element.innerHTML; if (html) { alert(html); window.clearInterval(window.__intervalHandle); window.__intervalHandle = null; } else { element.innerHTML = "At: " + ++i; } }, 1); document.getElementById("e2").innerHTML = "Test"; }); </code></pre> <p><strong>iOS pseudo code:</strong></p> <pre><code>- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSURL* u = [ request URL]; if( [[u scheme] compare:@"myapp" ] == NSOrderedSame) { { return NO; // don’t navigate } return YES; // navigate } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload