Re: [android-developers] AppCache not working in WebView with loadDataWithBaseURL()

2012-07-12 Thread Mark Murphy
Probably because they only examine the AppCache when going through HTTP.

On Thu, Jul 12, 2012 at 1:32 PM, Andy  wrote:
> All page content is loaded with HTTP.  Strangely, this static content does
> load successfully if it is sourced in the iframe document, but not if it is
> sourced in the literal HTML.  Even if there was a protocol difference, I
> can't understand why that would make a difference in the internal
> AppCache-fetching logic.
>
> On Tuesday, July 10, 2012 3:22:47 PM UTC-7, Mark Murphy (a Commons Guy)
> wrote:
>>
>> On Tue, Jul 10, 2012 at 1:19 PM, Andy Erickson wrote:
>> > However, specifying this base URL allows the iframed HTML to load from
>> > the
>> > AppCache, so it looks like some domain information is being extracted
>> > from
>> > the URL.  Is there any reason why the iframe element should load from
>> > the
>> > AppCache while the other elements do not?
>>
>> Because the  was downloaded over HTTP(S), and the other
>> elements were not.
>>
>> --
>> Mark Murphy (a Commons Guy)
>> http://commonsware.com | http://github.com/commonsguy
>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>
>> Android Training in NYC: http://marakana.com/training/android/
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] AppCache not working in WebView with loadDataWithBaseURL()

2012-07-12 Thread Andy
All page content is loaded with HTTP.  Strangely, this static content does 
load successfully if it is sourced in the iframe document, but not if it is 
sourced in the literal HTML.  Even if there was a protocol difference, I 
can't understand why that would make a difference in the internal 
AppCache-fetching logic.

On Tuesday, July 10, 2012 3:22:47 PM UTC-7, Mark Murphy (a Commons Guy) 
wrote:
>
> On Tue, Jul 10, 2012 at 1:19 PM, Andy Erickson wrote: 
> > However, specifying this base URL allows the iframed HTML to load from 
> the 
> > AppCache, so it looks like some domain information is being extracted 
> from 
> > the URL.  Is there any reason why the iframe element should load from 
> the 
> > AppCache while the other elements do not? 
>
> Because the  was downloaded over HTTP(S), and the other 
> elements were not. 
>
> -- 
> Mark Murphy (a Commons Guy) 
> http://commonsware.com | http://github.com/commonsguy 
> http://commonsware.com/blog | http://twitter.com/commonsguy 
>
> Android Training in NYC: http://marakana.com/training/android/ 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] AppCache not working in WebView with loadDataWithBaseURL()

2012-07-10 Thread Mark Murphy
On Tue, Jul 10, 2012 at 1:19 PM, Andy Erickson  wrote:
> However, specifying this base URL allows the iframed HTML to load from the
> AppCache, so it looks like some domain information is being extracted from
> the URL.  Is there any reason why the iframe element should load from the
> AppCache while the other elements do not?

Because the  was downloaded over HTTP(S), and the other
elements were not.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] AppCache not working in WebView with loadDataWithBaseURL()

2012-07-10 Thread Andy Erickson
However, specifying this base URL allows the iframed HTML to load from the 
AppCache, so it looks like some domain information is being extracted from 
the URL.  Is there any reason why the iframe element should load from the 
AppCache while the other elements do not?

On Tuesday, July 10, 2012 3:53:34 AM UTC-7, Mark Murphy (a Commons Guy) 
wrote:
>
> On Mon, Jul 9, 2012 at 2:12 PM, Andy Erickson wrote: 
> > Greetings!  I've been stumped on a WebView AppCache problem for a while 
> now. 
> > I'm attempting to use loadDataWithBaseURL() to load literal HTML 
> sourcing 
> > JS, CSS, images, and iframes into a WebView. 
>
> All the base URL is there for is to resolve relative URL references 
> AFAIK. I will be rather surprised if what you are trying to do is 
> supported. 
>
> -- 
> Mark Murphy (a Commons Guy) 
> http://commonsware.com | http://github.com/commonsguy 
> http://commonsware.com/blog | http://twitter.com/commonsguy 
>
> Android Training in DC: http://marakana.com/training/android/ 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] AppCache not working in WebView with loadDataWithBaseURL()

2012-07-10 Thread Mark Murphy
On Mon, Jul 9, 2012 at 2:12 PM, Andy Erickson  wrote:
> Greetings!  I've been stumped on a WebView AppCache problem for a while now.
> I'm attempting to use loadDataWithBaseURL() to load literal HTML sourcing
> JS, CSS, images, and iframes into a WebView.

All the base URL is there for is to resolve relative URL references
AFAIK. I will be rather surprised if what you are trying to do is
supported.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] AppCache not working in WebView with loadDataWithBaseURL()

2012-07-10 Thread Andy Erickson
Greetings!  I've been stumped on a WebView AppCache problem for a while 
now.  I'm attempting to use loadDataWithBaseURL() to load literal HTML 
sourcing JS, CSS, images, and iframes into a WebView.  At the same time I 
am using the HTML5 AppCache to store this content locally.  My problem is 
that when the device is offline, no content except the HTML sourced in the 
iframe is loaded from the AppCache.  I am certain that AppCache is enabled 
and that the content is being stored in the AppCache (I poked around with 
adb shell).  I am also specifying a correct base URL.  My code resembles 
this:

public class ExampleActivity extends Activity {
  ...
  // HTML to be inserted into the WebView with loadDataWithBaseURL()
  public static final String ALL_HTML = 
"" +
"" +
"" +
"" +   // doesn't load offline
"" +
"" +// loads
"" +// doesn't load
"" +// doesn't load
"";

  public void onCreate(Bundle savedInstanceState) {
...
WebView webView = new WebView(content);
webView.clearCache(true);

WebSettings settings = WebView.getSettings();
settings.setAppCacheEnabled(true);
settings.setJavaScriptEnabled(true);
  
webView.loadDataWithBaseURL("http://my.website.come/path/to/content/";,
ALL_HTML, "text/html", "utf-8", null);
  }
}

The manifest.html file is just responsible for sourcing the manifest.  It 
looks like:






and manifest.appcache looks like:

CACHE MANIFEST

# Explicitly cached resources
# manifest.html is automatically cached
sourced_js.js
android.jpg
android.gif
style.css

NETWORK:
*

When online, all content loads.  When offline, only the iframe with 
manifest.html loads from the AppCache.  None of the images, stylesheets, or 
JavaScript in the original literal html load in the WebView from AppCache 
when the device is offline, but if I source those same contents in 
manifest.html, they DO load in the iframe.  As if these resources have to 
be sourced secondarily.

I'm positively stumped--Are there rules regarding when AppCache can be used 
with loadDataWithBaseURL()?

Thanks a ton!

Andy

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en