Skip to content

Commit

Permalink
Favicon test pages (#198)
Browse files Browse the repository at this point in the history
* favicon tests

* Add some dynamic examples

* main page format fixed

---------

Co-authored-by: Shane Osbourne <[email protected]>
  • Loading branch information
federicocappelli and Shane Osbourne authored Apr 23, 2024
1 parent 25ebf3a commit 9ca082a
Show file tree
Hide file tree
Showing 14 changed files with 170 additions and 0 deletions.
Binary file added features/favicon/favicon_jpg/dax.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions features/favicon/favicon_jpg/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Favicon test JPG</title>
<link rel="shortcut icon" href="dax.jpg">
</head>
<body>
<p><a href="../../index.html">[Home]</a>/<a href="../index.html">[Favicon]</a></p>

<h1>JPG Favicon</h1>

</body>
</html>
Binary file added features/favicon/favicon_js/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions features/favicon/favicon_js/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Favicon test JS</title>
<link rel="shortcut icon" href="favicon.png">
</head>
<body>
<p><a href="../../index.html">[Home]</a>/<a href="../index.html">[Favicon]</a></p>

<h1>PNG Favicon replaced at runtime dax > skeleton dax</h1>

<p>
<button type="button" onclick="setDefault()">Set default now</button>
<br>
<small>Sets the <code>href</code> value of <code>link[rel='shortcut icon']</code> to
<code>./favicon.png</code></small>
</p>
<p>
<button type="button" onclick="setOverride()">Set override now</button>
<br>
<small>Sets the <code>href</code> value of <code>link[rel='shortcut icon']</code> to <code>./new_favicon.png</code></small>
</p>
<p>
<a href="?initial=override">Set override on page load </a>
<br>
<small>Reloads the page, and sets the override immediately</small>
</p>
<p>
<a href="?initial=delayed-override">Set override on page load, after 1s</a>
<br>
<small>Reloads the page, and sets the override after <code>1000ms (1s)</code></small>
</p>

<script>
function setDefault() {
document.querySelector("link[rel='shortcut icon']").href = "./favicon.png";
}

function setOverride() {
document.querySelector("link[rel='shortcut icon']").href = "./new_favicon.png";
}

// set an initial state
const initial = new URL(window.location.href).searchParams.get("initial");
if (initial) {
switch (initial) {
case "default":
setDefault();
break;
case "override":
setOverride();
break;
case "delayed-override":
setTimeout(setOverride, 1000)
break;
default:
console.warn("unsupported initial value")
}
}
</script>

</body>
</html>
Binary file added features/favicon/favicon_js/new_favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added features/favicon/favicon_png/dax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions features/favicon/favicon_png/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Favicon test PNG</title>
<link rel="shortcut icon" href="dax.png">
</head>
<body>
<p><a href="../../index.html">[Home]</a>/<a href="../index.html">[Favicon]</a></p>

<h1>PNG Favicon with custom name</h1>

</body>
</html>
1 change: 1 addition & 0 deletions features/favicon/favicon_svg/dax.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions features/favicon/favicon_svg/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Favicon test SVG</title>
<link rel="shortcut icon" href="dax.svg">
</head>
<body>
<p><a href="../../index.html">[Home]</a>/<a href="../index.html">[Favicon]</a></p>

<h1>SVG Favicon with custom name</h1>

</body>
</html>
14 changes: 14 additions & 0 deletions features/favicon/favicon_webapp_manifest/Manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Favicon webapp manifest test",
"short_name": "favicontest",
"start_url": "/index.html",
"icons": [
{
"src": "dax.png",
"sizes": "128x128",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff"
}
Binary file added features/favicon/favicon_webapp_manifest/dax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions features/favicon/favicon_webapp_manifest/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Favicon test json manifest</title>
<link rel="shortcut icon" href="dax.png">
<link rel="manifest" href="Manifest.json">
</head>
<body>
<p><a href="../../index.html">[Home]</a>/<a href="../index.html">[Favicon]</a></p>

<h1>PNG Favicon in a JSON manifest</h1>

</body>
</html>
28 changes: 28 additions & 0 deletions features/favicon/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Privacy Test Pages - Home</title>
</head>
<body>
<p><a href="../../index.html">[Home]</a></p>

<h1>Favicon Tests</h1>
<h2>Collection of test pages that load a favicon in a variety of formats and using different syntaxes and techniques</h2>
<p>A successful test shows a Dax favicon instead of the default grey icon</p>

<ul>
<li><a href="./favicon_png/index.html">PNG favicon</a></li>
<li><a href="./favicon_svg/index.html">SVG favicon</a></li>
<li><a href="./favicon_jpg/index.html">JPG favicon</a></li>
<li><a href="./favicon_webapp_manifest/index.html">Favicon in a json manifest</a></li>
<li><a href="./favicon_js/index.html">Favicon replaced at runtime</a></li>
<ul>
<li><a href="./favicon_js/index.html?initial=override">Favicon automatically replaced after page load</a></li>
<li><a href="./favicon_js/index.html?initial=delayed-override">Favicon automatically replaced after 1s</a></li>
</ul>
</ul>

</body>
</html>
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ <h2>Browser Features</h2>
<li><a href="./features/harmful-apis/">Harmful APIs</a></li>
<li><a href="./features/element-hiding/">Element Hiding</a></li>
<li><a href="./features/auto-refresh.html">Auto Refresh</a></li>
<li><a href="./features/favicon/">Favicon</a></li>
</ul>

<h2>Security</h2>
Expand Down

0 comments on commit 9ca082a

Please sign in to comment.