Skip to content

Commit 529d6db

Browse files
committed
fix base href
1 parent b7d360c commit 529d6db

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

demo/WasmHost/wwwroot/.nojekyll

Whitespace-only changes.

demo/WasmHost/wwwroot/404.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,25 @@
77
<title>WasmHost</title>
88
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
99
<link href="css/site.css" rel="stylesheet" />
10+
<base href="/" />
1011
</head>
1112

1213
<body>
1314
<app>Loading...</app>
1415

16+
<script type="text/javascript">
17+
// if domain ends with .github.io, fix <base href ...>
18+
if (window.location.host.endsWith(".github.io"))
19+
{
20+
var base = window.location.protocol
21+
+ "//" + window.location.host
22+
+ "/" + window.location.pathname.split("/")[1] + "/";
23+
24+
baseElement = document.getElementsByTagName("head")[0].getElementsByTagName("base")[0];
25+
baseElement.href = base;
26+
}
27+
</script>
28+
1529
<div id="blazor-error-ui">
1630
An unhandled error has occurred.
1731
<a href="" class="reload">Reload</a>

demo/WasmHost/wwwroot/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,25 @@
77
<title>WasmHost</title>
88
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
99
<link href="css/site.css" rel="stylesheet" />
10+
<base href="/" />
1011
</head>
1112

1213
<body>
1314
<app>Loading...</app>
1415

16+
<script type="text/javascript">
17+
// if domain ends with .github.io, fix <base href ...>
18+
if (window.location.host.endsWith(".github.io"))
19+
{
20+
var base = window.location.protocol
21+
+ "//" + window.location.host
22+
+ "/" + window.location.pathname.split("/")[1] + "/";
23+
24+
baseElement = document.getElementsByTagName("head")[0].getElementsByTagName("base")[0];
25+
baseElement.href = base;
26+
}
27+
</script>
28+
1529
<div id="blazor-error-ui">
1630
An unhandled error has occurred.
1731
<a href="" class="reload">Reload</a>

output/demo/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)