Hmmm...another piece to the puzzle.
I intercept the HTML to see what it looks like and although the page stops
loading, when I inspect it, all I see is an empty HTML page! So for
whatever reason, the problem devices aren't getting the data loaded when I
retrieve it over the Internet.
For those who want to know how to intercept the HTML, here is what you do
just BEFORE your call to WebView.loadUrl()
// intercept calls to console.log
webview.setWebChromeClient(new WebChromeClient()
{
public boolean onConsoleMessage(ConsoleMessage cmsg)
{
// check secret prefix
if (cmsg.message().startsWith("MAGIC"))
{
String msg = cmsg.message().substring(5); // strip off
prefix
// process HTML
DebugLog.d(TAG, msg);
return true;
}
return false;
}
});
// inject the JavaScript on page load
webview.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String address)
{
// have the page spill its guts, with a secret prefix
view.loadUrl("javascript:console.log('MAGIC'+document.getElementsByTagName('html')[0].innerHTML);");
//Stop the spinner
activityIndicator.setVisibility(View.GONE);
}
});
On Friday, November 30, 2012 12:03:33 PM UTC-6, darrinps wrote:
>
> Nothing really special. No javascript (and I even turned that off in the
> webview first thing as a guess). One line of CSS is all.
>
> Are you suggesting that I read in the HTML, save it off and then load it
> back from file like I did to test it?
>
>
>
> On Friday, November 30, 2012 11:02:06 AM UTC-6, mbanzon wrote:
>>
>> Is there anything special on the pages? Javascript or embedded elements -
>> some fancy transitions e.g. in CSS?
>>
>> I'm thinking that the renderer is preventing some "advanced" stuff on
>> pages loaded from "internet" instead of local - where it is trusted.
>>
>> A possible workaround would be to load the pages yourself and display
>> them in the way that works?
>>
>>
>> On Fri, Nov 30, 2012 at 5:52 PM, wrote:
>>
>>> I have some old 2.3 devices that just won't display some HTML pages
>>> which all other devices seem to work just fine. All the ones with problems
>>> show is a blank page.
>>>
>>> The really odd thing is that if I copy the HTML file onto the phone,
>>> then do this:
>>>
>>> webview.loadUrl("file:///sdcard/page.html");
>>>
>>> then it works just fine!
>>>
>>> Why on earth it would work when locally yet not work when loaded from
>>> the Internet I do not know.
>>>
>>> Anyone run into this before and if so, how did you get around it?
>>>
>>>
>>>
>>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en