开发者

Setting the .htaccess MIME type to text/cache-manifest in XAMPP to view websites offline in HTML5

I've seen pretty much all the tutorials in the web about how to make your site viewable offline using the cache manifest and they all say something like this:

A manifest file must be served with the mime-type text/cache-manifest. You may need to add a custom file type to your web server or .htaccess configuration.

But when I look at my XAMPP directory, there aren't any files named ".htaccess" in my xampp/htdocs folder. I did a search under the xampp/ directory and there's quite a lot of them, one in each folder below:

  • xampp/htdocs/drupal
  • xampp/phpMyAdmin/setup/lib
  • xampp/phpMyAdmin/libraries
  • xampp/htdocs/xampp/sqlite
  • xampp/htdocs/forbidden
  • xampp/phpMyAdmin/contrib

My partner here says I have to make that myself inside xampp/htdocs/开发者_StackOverflownameOfTheFolderOfMyWebApp but I don't quite trust him since it didn't work. Help?


This may help, at least for testing:

Since you are using PHP, you could create a PHP file named themanifestfile.php with this content:

<?php header('Content-type: text/cache-manifest'); ?>CACHE MANIFEST

demoimages/clownfish.jpg
demoimages/clownfishsmall.jpg
demoimages/flowingrock.jpg
# THE REST OF YOUR OFFLINE FILES GO HERE

Then, in your html:

<html manifest="themanifestfile.php">

I know this doesn't directly answer your question, but it may save you a lot of time fighting against apache configuration files if you only need to test your app.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜