-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5adfed6
commit 60a8ff3
Showing
1 changed file
with
13 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |