Thursday, February 28, 2013

Re: HTML5 Offline apps with Django 1.4

Hi Ranjith,

Perhaps I've confused things here -- when you're serving offline HTML5, you need to serve (at least) 2 pages -- a page with html, and a *completely separate* second page containing the manifest. The manifest file has a content type of text/cache-manifest; your HTML is served with a normal text/html content type. 

From what you describe, it sounds like you're just serving the HTML as text/cache-manifest.

Yours,
Russ Magee %-)

On Tue, Feb 26, 2013 at 10:34 AM, Ranjith Chaz <ranjjose@gmail.com> wrote:
Thanks for the reply, Russell. I had tried it already. What I get when I do this is, the html source instead of the web page. That is, the complete html code gets printed out in the browser and it happens in all browsers irrespective of mobile, desktop.


On Thursday, February 21, 2013 1:08:16 PM UTC+5:30, Ranjith Chaz wrote:
Trying to implement offline feature of HTML5.  Deployed in apache2.2 with mod_wsgi plugin.
It works as expected (i.e., loads the cached page when offline) in chrome, Opera (using window.openDatabase) and other desktop browsers. However it doesn't work in Android 2.x, iPhone default browsers. Strangely, it works with Android 4.0 browser!!
Here is the code:

HTML
<!DOCTYPE HTML>      <html manifest="{{MEDIA_URL}}cache.manifest">         <head>            <meta charset="utf-8">                  <title>MyHomeStuff</title>                  <script type="text/javascript" src="{{MEDIA_URL}}MyHomeStuff.js" ></script>            <script></script>         </head>         <body>           .............         </body>      </html>

Apache conf\mime.types text/cache-manifest manifest


\Python27\Lib\mimetypes.py Added '.manifest': 'text/cache-manifest', into types_map dict

(With the above addition to mimetypes.py, it started working for android 4.0)


cache.manifest CACHE MANIFEST
CACHE: index.html MyHomeStuff.js


views.py:

def offlineApp(request):      t = get_template('index.html')      html = t.render(Context({'MEDIA_URL':'http://myDomain.com/site_media/'}))      return HttpResponse(html)

Is it required to use any specific module/middleware to handle text/manifest in django ?
Any help is appreciated. Already spent a lot of time on this!


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment