Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Blobby-Boi committed Oct 8, 2023
1 parent 5adfed6 commit 60a8ff3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<style>
#thing, #submit {
margin: 0 auto;
width: 200px;
}
</style>
<script>
// Get the URL from the user.
const thing = window.prompt("Enter URL here:");
const thing = document.getElementById("thing");

// Check if the URL already includes a protocol.
if (thing.startsWith("https://") || thing.startsWith("http://")) {
if (thing.value.startsWith("https://") || thing.value.startsWith("http://")) {
// Open the URL directly.
window.location.href = thing;
window.location.href = thing.value;
} else {
// Prepend the HTTPS protocol to the URL and open it.
window.location.href = "https://" + thing;
window.location.href = "https://" + thing.value;
}
</script>
</head>
<body>
<input type="text" id="thing" placeholder="Enter URL here...">
<button type="button" id="submit">Submit</button>
</body>
</html>

0 comments on commit 60a8ff3

Please sign in to comment.