Handle deep links to Angular in Github pages.
This commit is contained in:
Родитель
f367e5d52f
Коммит
7bbfb386f8
|
@ -11,7 +11,8 @@
|
|||
"outDir": "dist/apps/docs",
|
||||
"assets": [
|
||||
"assets",
|
||||
"favicon.ico"
|
||||
"favicon.ico",
|
||||
"404.html"
|
||||
],
|
||||
"index": "index.html",
|
||||
"main": "main.ts",
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<title>Angular-React</title>
|
||||
|
||||
<script>
|
||||
// Store the URL the user was trying to access when receiving the 404.
|
||||
sessionStorage.redirect = location.href;
|
||||
</script>
|
||||
|
||||
<!-- Immediately redirect to the base URL so we can use the SPA routing. -->
|
||||
<meta http-equiv="refresh" content="0;URL='/'"></meta>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- IE required at least 512 bytes of data to show non-default 404. -->
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -9,6 +9,22 @@
|
|||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<!-- Github Pages hack to allow SPA refresh without receiving 404. -->
|
||||
<script>
|
||||
(function () {
|
||||
// Retrieve the URL the user was trying to access when receiving the 404.
|
||||
var redirect = sessionStorage.redirect;
|
||||
// Remove the URL from sessionStorage.
|
||||
delete sessionStorage.redirect;
|
||||
// Check if we actually need to redirect.
|
||||
if (redirect && redirect != location.href) {
|
||||
// We need to redirect to the URL the user was trying to access.
|
||||
history.replaceState(null, null, redirect);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<!-- /Github Pages hack. -->
|
||||
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<title>Angular-React</title>
|
||||
|
||||
<script>
|
||||
// Store the URL the user was trying to access when receiving the 404.
|
||||
sessionStorage.redirect = location.href;
|
||||
</script>
|
||||
|
||||
<!-- Immediately redirect to the base URL so we can use the SPA routing. -->
|
||||
<meta http-equiv="refresh" content="0;URL='/'"></meta>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- IE required at least 512 bytes of data to show non-default 404. -->
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1 +1,11 @@
|
|||
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Angular-React</title><base href="https://benfeely.github.io/angular-react/"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"><link href="styles.e8b13e972546fbece65e.bundle.css" rel="stylesheet"/></head><body><app-root></app-root><script type="text/javascript" src="inline.318b50c57b4eba3d437b.bundle.js"></script><script type="text/javascript" src="polyfills.9177b919595504beb544.bundle.js"></script><script type="text/javascript" src="main.d8ff5900858a08c46f11.bundle.js"></script></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Angular-React</title><base href="https://benfeely.github.io/angular-react/"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"><link href="styles.e8b13e972546fbece65e.bundle.css" rel="stylesheet"/></head><body><!-- Github Pages hack to allow SPA refresh without receiving 404. --><script>(function () {
|
||||
// Retrieve the URL the user was trying to access when receiving the 404.
|
||||
var redirect = sessionStorage.redirect;
|
||||
// Remove the URL from sessionStorage.
|
||||
delete sessionStorage.redirect;
|
||||
// Check if we actually need to redirect.
|
||||
if (redirect && redirect != location.href) {
|
||||
// We need to redirect to the URL the user was trying to access.
|
||||
history.replaceState(null, null, redirect);
|
||||
}
|
||||
})();</script><!-- /Github Pages hack. --><app-root></app-root><script type="text/javascript" src="inline.318b50c57b4eba3d437b.bundle.js"></script><script type="text/javascript" src="polyfills.9177b919595504beb544.bundle.js"></script><script type="text/javascript" src="main.d8ff5900858a08c46f11.bundle.js"></script></body></html>
|
Загрузка…
Ссылка в новой задаче