HTML and CSS Reference
In-Depth Information
setInterval( function() {
var hours = new Date().getHours();
$("#hours").html(( hours < 10 ? "0" : "" ) + hours);
}, 1000);
});
This code uses the setInterval() JavaScript function to update the time after every 1,000
milliseconds. The current date is also displayed at the top of the clock using the JavaScript Date object and
its methods. Notice how browser support for offline applications is detected using the Modernizr.
applicationcache property.
Configuring IIS to Recognize the Cache Manifest File
In order for an offline application to work as expected, the browser should be able to download the cache
manifest file successfully from the web server. It's important that the web server (IIS) serve the cache
manifest with the extension you use ( .cachemanifest in this case). Earlier it was mentioned that .manifest
and .appcache are commonly used file extensions for the cache manifest; be aware that .manifest is also
used by .NET ClickOnce deployment, and IIS may already have an entry for it (see Figure 8-3).
Figure 8-3. MIME types configured in IIS
Considering this, you may want to use another file extension (such as .appcache or .cachemanifest ) to
avoid confusion. Once you decide on a file extension, you need to add its MIME content type in IIS as
text/cache-manifest . This way, IIS serves the cache manifest file correctly to the requesting browser.
There is also an alternative to using IIS Manager: your web application's web.config. . You can configure
the cache manifest file extension using the mimeMap element of web.config. . Listing 8-7 shows how to map
the .cachemanifest file extension to the MIME type text/cache-manifest .
 
Search WWH ::




Custom Search