Skip to content

Commit

Permalink
Fix serving of dotnet with gh pages
Browse files Browse the repository at this point in the history
  • Loading branch information
yostane committed Sep 22, 2024
1 parent e5ecd66 commit 547aad4
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<base />
<base href="/MangedDoom-Blazor/" />
<meta charset="utf-8" />
<meta
name="viewport"
Expand All @@ -17,21 +17,6 @@
const downKeys = [];

window.addEventListener("DOMContentLoaded", () => {
// https://blog.elmah.io/how-to-fix-blazor-wasm-base-path-problems
const path = window.location.pathname.split("/");
const base = document.getElementsByTagName("base")[0];
if (window.location.host.includes("localhost")) {
base.setAttribute("href", "/");
} else if (path.length > 2) {
base.setAttribute("href", "/" + path[1] + "/");
} else if (path[path.length - 1].length != 0) {
window.location.replace(
window.location.origin +
window.location.pathname +
"/" +
window.location.search
);
}
document.body.addEventListener("keydown", function (e) {
if (e.target.tagName === "INPUT") {
return true;
Expand Down

0 comments on commit 547aad4

Please sign in to comment.