accept urls without scheme

This commit is contained in:
Gianni Carafa
2023-11-03 08:24:57 +01:00
parent e3389d2df3
commit bf2529753d
2 changed files with 10 additions and 4 deletions

View File

@@ -159,8 +159,11 @@
}); });
document.getElementById('inputForm').addEventListener('submit', function (e) { document.getElementById('inputForm').addEventListener('submit', function (e) {
e.preventDefault(); e.preventDefault();
const inputValue = document.getElementById('inputField').value; let url = document.getElementById('inputField').value;
window.location.href = '/' + inputValue; if (url.indexOf('http') === -1) {
url = 'https://' + url;
}
window.location.href = '/' + url;
return false; return false;
}); });
</script> </script>

View File

@@ -179,8 +179,11 @@ const html = `
}); });
document.getElementById('inputForm').addEventListener('submit', function (e) { document.getElementById('inputForm').addEventListener('submit', function (e) {
e.preventDefault(); e.preventDefault();
const inputValue = document.getElementById('inputField').value; let url = document.getElementById('inputField').value;
window.location.href = '/' + inputValue; if (url.indexOf('http') === -1) {
url = 'https://' + url;
}
window.location.href = '/' + url;
return false; return false;
}); });
</script> </script>