diff --git a/assets/index.html b/assets/index.html index 0cf508a..ab01d13 100644 --- a/assets/index.html +++ b/assets/index.html @@ -159,8 +159,11 @@ }); document.getElementById('inputForm').addEventListener('submit', function (e) { e.preventDefault(); - const inputValue = document.getElementById('inputField').value; - window.location.href = '/' + inputValue; + let url = document.getElementById('inputField').value; + if (url.indexOf('http') === -1) { + url = 'https://' + url; + } + window.location.href = '/' + url; return false; }); diff --git a/handlers/form.go b/handlers/form.go index cab5138..49b9977 100644 --- a/handlers/form.go +++ b/handlers/form.go @@ -179,8 +179,11 @@ const html = ` }); document.getElementById('inputForm').addEventListener('submit', function (e) { e.preventDefault(); - const inputValue = document.getElementById('inputField').value; - window.location.href = '/' + inputValue; + let url = document.getElementById('inputField').value; + if (url.indexOf('http') === -1) { + url = 'https://' + url; + } + window.location.href = '/' + url; return false; });