-
Problems
This line enable URL Rewriting . It must be enabled via the RewriteEngine directive! and if your .htaccess file is going to use rewrite rules, you should always include this line. Otherwise, you can’t be sure if its enabled or not. The string “on” is case insensitive.
devices all the time, it’s unwise to assume that our visitors will always have a live
internet connection. Wouldn’t it be nice for our visitors to browse our site or use
our web application even if they’re offline? Thankfully, we can, with Offline Web
Applications.
HTML5’s OfflineWeb Applications allows us to interact with websites offline. This
initially might sound like a contradiction: a web application exists online by
definition. But there are an increasing number of web-based applications that could
benefit from being usable offline. You probably use a web-based email client, such
as Gmail; wouldn’t it be useful to be able to compose drafts in the app while you
were on the subway traveling to work? What about online to-do lists, contact managers,
or office applications? These are all examples of applications that benefit
from being online, but which we’d like to continue using if our internet connection
cuts out in a tunnel.
The Offline Web Applications spec is supported in:
¦ Safari 4+
¦ Chrome 5+
¦ Firefox 3.5+
¦ Opera 10.6+
¦ iOS (Mobile Safari) 2.1+
¦ Android 2.0+
It is currently unsupported in all versions of IE.
Three Step for creating webpage offiline:
STEP ONE:Create a cache.manifest file.
STEP TWO:Ensure that the manifest file is served with the correct content type.
STEP THREE:Point all your HTML files to the cache manifest.
STEP ONE: CREATING cache.manifest file:-A simple manifest file can contain below code:
CACHE MANIFEST
CACHE:
index.html
logo.jpg
NETWORK:
*
Explanation of above code:
The first line of the cache.manifest file must read CACHE MANIFEST. After this line,
we enter CACHE:, and then list all the files we’d like to store on our visitor’s hard
drive. This CACHE: section is also known as the explicit section (since we’re explicitly
telling the browser to cache these files).
Upon first visiting a page with a cache.manifest file, the visitor’s browser makes a
local copy of all files defined in the section. On subsequent visits, the browser will
load the local copies of the files.
The below NETWORK section allow user to specify file that should only available when user is online.
The first line of this section is the word NETWORK. Any files specified in the NETWORK
section will always be reloaded when the user is online, and will never be available
offline.
STEP TWO: SERVING MENIFEST TO CORRECT CONTENT TYPE:
The next step in making your site available offline is to ensure that your server is
configured to serve the manifest files correctly. This is done by setting the content
type provided by your server along with the cache.manifest file
Assuming you’re using the Apache web server, add the following to your .htaccess
file:
AddType text/cache-manifest .manifest
STEP THREE:Pointing your HTML files to cache.manifest.
The final step to making your website available offline is to point your HTML pages
to the manifest file.We do that by setting the manifest attribute on the html element
in each of our pages:
<!doctype html>
<html manifest="/cache.manifest">
Once we’ve done that, we’re finished! Our web page will now be available offline.
Better still, since any content that hasn’t changed since the page has been viewed
will be stored locally, our page will now load much faster—even when our visitors
are online.Do this for every html page which you want to available for offiline.
No comments:
Post a Comment