Skip to content

Commit

Permalink
Fix the webserver's HTML correctness
Browse files Browse the repository at this point in the history
The doctype tag must be provided, otherwise e.g. Firefox logs a warning
about running the page in quirks mode in the web console. The `target`
attribute being set to `pdf` doesn't do anything and according to MDN
is even an unsupported value for the attribute.
  • Loading branch information
timvandermeij committed Feb 11, 2024
1 parent 7e2ff41 commit c7a98a2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions test/webserver.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ WebServer.prototype = {
return;
}
res.write(
'<html><head><meta charset="utf-8"></head><body>' +
'<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>' +
"<h1>Index of " +
pathPart +
"</h1>\n"
Expand Down Expand Up @@ -239,7 +239,6 @@ WebServer.prototype = {
} else if (path.extname(file).toLowerCase() === ".pdf") {
href = "/web/viewer.html?file=" + encodeURIComponent(item);
label = file;
extraAttributes = ' target="pdf"';
} else {
href = encodeURI(item);
label = file;
Expand Down

0 comments on commit c7a98a2

Please sign in to comment.