Monday, February 25, 2013

Re: HTML5 Offline apps with Django 1.4

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.
 
 

No comments:

Post a Comment