-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path404.html
More file actions
89 lines (86 loc) · 3.63 KB
/
Copy path404.html
File metadata and controls
89 lines (86 loc) · 3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv="Content-Security-Policy"
content="script-src 'nonce-aem' 'strict-dynamic' 'unsafe-inline' http: https:; base-uri 'self'; object-src 'none';"
move-to-http-header="true"
>
<title>404 - Page Not Found | Intuit Enterprise Suite</title>
<script nonce="aem" type="text/javascript">
// Trailing-slash recovery: canonical pages serve at /page/ (folder + index
// doc); EDS serves /page and /page/ as different resources and does not
// redirect between them, so a slash-free /page 404s. When this error page
// loads for a slash-free, extension-less path, redirect to the canonical
// /page/ form (preserving query + hash) before anything paints. replace()
// keeps the bad URL out of history. Skips the root, already-slashed paths,
// and file-like paths (last segment has a dot, e.g. /scripts/x.js).
(function redirectAddTrailingSlash() {
const { pathname, search, hash } = window.location;
const lastSegment = pathname.split('/').pop();
if (pathname.length > 1 && !pathname.endsWith('/') && !lastSegment.includes('.')) {
window.location.replace(`${pathname}/${search}${hash}`);
}
}());
</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="The page you're looking for cannot be found">
<meta property="og:title" content="404 - Page Not Found | Intuit Enterprise Suite">
<meta property="og:description" content="The page you're looking for cannot be found">
<script nonce="aem" src="/scripts/scripts.js" type="module"></script>
<script nonce="aem" type="module">
import { sampleRUM } from '/scripts/aem.js';
sampleRUM('404', { source: document.referrer });
</script>
<script nonce="aem" type="module">
// Same-origin referrer? Offer a "Go back" link next to the fragment's
// own CTA buttons. The fragment (and its buttons) load asynchronously
// via the standard block pipeline, so wait for it with a MutationObserver
// rather than assuming it's ready by any fixed point (e.g. window.load).
let backHref;
try {
const { origin, pathname } = new URL(document.referrer);
if (origin === window.location.origin) backHref = pathname;
} catch {
// malformed referrer — skip the "Go back" link
}
if (backHref) {
const addBackLink = (fragment) => {
const lastWrapper = [...fragment.querySelectorAll('.button-wrapper')].pop();
if (!lastWrapper) return false;
const wrapper = document.createElement('p');
wrapper.className = 'button-wrapper';
const link = document.createElement('a');
link.className = 'button secondary';
link.href = backHref;
link.title = 'Go back';
link.textContent = 'Go back';
wrapper.append(link);
lastWrapper.after(wrapper);
return true;
};
window.addEventListener('load', () => {
const fragment = document.querySelector('main.error .fragment');
if (!fragment || addBackLink(fragment)) return;
new MutationObserver((mutations, observer) => {
if (addBackLink(fragment)) observer.disconnect();
}).observe(fragment, { childList: true, subtree: true });
});
}
</script>
<link rel="stylesheet" href="/styles/styles.css">
<link rel="stylesheet" href="/styles/error.css">
<link rel="stylesheet" href="/styles/lazy-styles.css">
</head>
<body>
<header></header>
<main class="error">
<div class="section">
<div class="fragment">
<a href="/fragments/404">/fragments/404</a>
</div>
</div>
</main>
<footer></footer>
</body>
</html>