From 68b255cf4b842e58c5dc529e3cfd5f72d47cc020 Mon Sep 17 00:00:00 2001 From: Maxwell Drake Date: Sun, 7 Apr 2024 00:39:19 +0000 Subject: [PATCH] Update 'frontend.js' --- frontend.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/frontend.js b/frontend.js index 3298d53..86ce582 100644 --- a/frontend.js +++ b/frontend.js @@ -109,6 +109,36 @@ function createParagraph(elementID, text) { return elem } +function initHead(pageTitle = "") { + // Create head element + let head = document.createElement("head"); + + // Create title element + let titleElement = document.createElement("title"); + titleElement.textContent = pageTitle; + + // Create link element for app icon + let appIcon = document.createElement("link"); + appIcon.rel = "apple-touch-icon"; + appIcon.sizes = "180x180"; + appIcon.href = "icon.png"; + + // Create link element for favicon + let favicon = document.createElement("link"); + favicon.rel = "icon"; + favicon.type = "image/png"; + favicon.href = "icon.png"; + + // Append title, app icon, and favicon to the head element + head.appendChild(titleElement); + head.appendChild(appIcon); + head.appendChild(favicon); + + // Append head element to the document + document.documentElement.insertBefore(head, document.documentElement.firstChild); +} + + function initBody(bodyID = "body") { // Create a new body element with the desired id const newBody = document.createElement("body");