Difference between revisions of "User:HallowizerTEST/common.js"
Jump to navigation
Jump to search
(Better style) |
m (syntax fix) |
||
Line 3: | Line 3: | ||
var li = document.createElement("li"); | var li = document.createElement("li"); | ||
var href = "https://" + location.href.substring("http://".length); | var href = "https://" + location.href.substring("http://".length); | ||
− | li.innerHTML = '<a href="' + href + '">Upgrade to HTTPS</a> | + | li.innerHTML = '<a href="' + href + '">Upgrade to HTTPS</a>'; |
nav.insertBefore(ali, nav.children[1]); | nav.insertBefore(ali, nav.children[1]); | ||
} | } |
Revision as of 22:21, 24 April 2021
if (location.href.startsWith("http://")) {
var nav = document.querySelector("#p-navigation ul");
var li = document.createElement("li");
var href = "https://" + location.href.substring("http://".length);
li.innerHTML = '<a href="' + href + '">Upgrade to HTTPS</a>';
nav.insertBefore(ali, nav.children[1]);
}