w3resource

HTML5: How to specify the address of the document's cache manifest?

Go to Exercise page

Solution:

HTML Code:

<!doctype html>
<html manifest="https://www.w3resource.com/html-css-exercise/basic/solution/w3r_example.appcache">
<head>
<title>This is an example of HTML manifest attribute</title>
<link rel="stylesheet" type="text/css" href="https://www.w3resource.com/html-css-exercise/basic/solution/findbrowser.css">
</head>
<body>
<img src="https://www.w3resource.com/images/w3resource-logo.png" alt="w3resource logo">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed urna eros, varius vitae odio at, scelerisque bibendum dui. Suspendisse pellentesque mauris non blandit porttitor. In hac habitasse platea dictumst. Sed eu leo eu leo sagittis porttitor id id lorem. Fusce pretium justo nisl, non porttitor nulla sollicitudin a. Duis porta in metus congue rhoncus. Pellentesque non orci massa. Sed dictum, massa et ornare rutrum, dui erat vehicula felis, non pellentesque sapien dui maximus dolor.</p>
<button onclick="findBrowser()">Show my browser</button>
<p id="display"></p>
<script src="https://www.w3resource.com/html-css-exercise/basic/solution/findbrowser.js"></script>
<p>Note : If you <a href="https://www.w3resource.com/html-css-exercise/basic/solution/findbrowswer.html">open the file and then go offline, you will still be able to see the page and interactivity</p>
</body>
</html>

CSS Code:


body {
background-color: #f4f7f8;
color: #1eb6f1
}

button {
background-color: #52ad4c;
color: #fff;
font-size: 20px
}

a:link, a:visited, a:active, a:hover {
color: #ea6512
}

JavaScript Code :


function findBrowser() {
  var wn = window.navigator,
        platform = wn.platform.toString().toLowerCase(),
        userAgent = wn.userAgent.toLowerCase(),
        storedName;

// ie
    if (userAgent.indexOf('msie',0) !== -1) {
        browserName = 'ie';
        os = 'win';
        storedName = userAgent.match(/msie[ ]\d{1}/).toString();
        version = storedName.replace(/msie[ ]/,'');

        browserOsVersion = browserName + version;
    }
var el = document.getElementById("display");
el.innerText = platform + userAgent;
}

Manifest

CACHE MANIFEST
# v1 2015-06-26
# This is another comment
https://www.w3resource.com/html-css-exercise/basic/solution/findbrowser.js
https://www.w3resource.com/images/w3resourcelogo.gif
https://www.w3resource.com/html-css-exercise/basic/solution/findbrowser.css

Live Demo:

See the Pen html-manifest-answer by w3resource (@w3resource) on CodePen.


See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo
YesYesYesYesYes

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Share this Tutorial / Exercise on : Facebook and Twitter

HTML-CSS: Tips of the Day

HTML span align center not working?

<span align="center" style="border:1px solid red;">
    This is some text in a div element!
</span> 

However, the align attribute is deprecated. You should use the CSS text-align property on the container.

<div style="text-align: center;">
    <span style="border:1px solid red;">
        This is some text in a div element!
    </span>
</div> 

Ref: https://bit.ly/3RZXhp2