text/manifest mime-type and HTML5 caching

106 views
Skip to first unread message

dinja

unread,
Feb 12, 2012, 12:40:54 PM2/12/12
to rhomobile
Hi,
does Rhodes support custom mime-type declaration and HTML5 caching?
If so, how do I do it?
Denis

Jon Tara

unread,
Feb 12, 2012, 1:14:25 PM2/12/12
to rhom...@googlegroups.com
These are browser capabilities, so Rhodes has nothing to do with it. If it is supported on your device's WebViews, then it is supported.

That said, I don't see a use case for it in a Rhodes app. What would be the purpose?

dinja

unread,
Feb 12, 2012, 1:32:27 PM2/12/12
to rhomobile
Hi Jon,
The reason why I need this is that I would like to cache google maps
JS and tiles locally as described in the link below
http://blogs.missouristate.edu/web/2010/05/12/google-maps-api-v3-developing-for-mobile-devices/

While I agree with you about HTML5 device browser capability, there is
a little "but". The problem is that .appcache manifest is served as
text/plain, not as text/manifest mime type, therefore browser gives an
error while trying to parse it. Normally, you would specify mime-type
for certain files in the .htaccess file (on Apache), but I don't
believe that is the case in Rhodes.

So, the question is: Is there a way to specify a mime-type for certain
types of files in the local mobile server in Rhodes?

Regards,
Denis

Jon Tara

unread,
Feb 12, 2012, 2:03:09 PM2/12/12
to rhom...@googlegroups.com
You can use a <meta> tag to set the mime-type. If you are serving the manifest using an .erb, you would need to use a custom layout. Otherwise, if you are serving this from /public, just include the meta in the page. I don't think there is any way (say, a render option) to set HTTP header fields programatically. Fortunately, there is the meta escape hatch.

<meta http-equiv="Content-Type" content="text/manifest";/>

Jon Tara

unread,
Feb 12, 2012, 2:06:30 PM2/12/12
to rhom...@googlegroups.com
Correction:

dinja

unread,
Feb 12, 2012, 2:44:04 PM2/12/12
to rhomobile
META Tag is an HTML tag. App cache manifest on the other side is not
an HTML file. And there is no way I can embed it into erb (at least I
can't think of any way how I can do that)

Are you sure there is no any way we can set HTTP headers in ruby
before render happens?

Thanks a lot,
Denis

dinja

unread,
Feb 12, 2012, 2:50:49 PM2/12/12
to rhomobile
http://groups.google.com/group/rhomobile/browse_thread/thread/7ab60a9add681f9/251eabf8df39667b?lnk=gst&q=json+render#251eabf8df39667b

Apparently, you can set @response['headers'] in ruby. I'm gonna try
this right now.

Cheers,
Denis

dinja

unread,
Feb 12, 2012, 4:33:30 PM2/12/12
to rhomobile
Nevermind, it was a bad idea from the beginning. Although modifying
@response in the controller worked and I managed to get the cache
working, it didn't work with google maps.

Thanks for your help,
Denis

On Feb 12, 7:50 pm, dinja <gravismas...@gmail.com> wrote:
> http://groups.google.com/group/rhomobile/browse_thread/thread/7ab60a9...
Reply all
Reply to author
Forward
0 new messages