A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3resource.com/html-css-exercise/basic/html-manifest-answer.php below:

Website Navigation


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

HTML5: How to specify the address of the document's cache manifest?Last update on February 09 2024 12:52:54 (UTC/GMT +8 hours)

Go to Exercise page

Solution:

HTML Code:

<!doctype html><!-- Declaration specifying the document type -->
<html manifest="https://www.w3resource.com/html-css-exercise/basic/solution/w3r_example.appcache"><!-- Root element with manifest attribute specifying the URL of the cache manifest file -->
<head><!-- Opening tag for the document's header section -->
<title>This is an example of HTML manifest attribute</title><!-- Title of the HTML document -->
<link rel="stylesheet" type="text/css" href="https://www.w3resource.com/html-css-exercise/basic/solution/findbrowser.css"><!-- Link to an external CSS stylesheet -->
</head><!-- Closing tag for the document's header section -->
<body><!-- Opening tag for the document's body section -->
<img src="https://www.w3resource.com/images/w3resource-logo.png" alt="w3resource logo"><!-- Image element displaying the 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><!-- Paragraph element with Lorem Ipsum text -->
<button onclick="findBrowser()">Show my browser</button><!-- Button triggering a JavaScript function -->
<p id="display"></p><!-- Paragraph element with an empty ID to display browser information -->
<script src="https://www.w3resource.com/html-css-exercise/basic/solution/findbrowser.js"></script><!-- Link to an external JavaScript file -->
<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><!-- Note about offline accessibility -->
</body><!-- Closing tag for the document's body section -->
</html><!-- Closing tag for the root element of the HTML document -->

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

Explanation:

Live Demo:

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

See the solution in the browser

Supported browser

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4