Skip to content

Instantly share code, notes, and snippets.

@PhilsThinkerBox1982
Created September 24, 2025 01:47
Show Gist options
  • Select an option

  • Save PhilsThinkerBox1982/f2b73f3db1cf99ba6898d55144fb9691 to your computer and use it in GitHub Desktop.

Select an option

Save PhilsThinkerBox1982/f2b73f3db1cf99ba6898d55144fb9691 to your computer and use it in GitHub Desktop.
Web Browser
<!DOCTYPE html>
<html>
<head>
<style>
input { width: 200px; margin: 2px; font-size:24pt;background-color:darkgreen;color:lime}
</style>
</head>
<body>
<input type="text" id="urlInput" placeholder="e.g. example.com" style="border-radius:12px; font-size:48px; background-color:darkgreen; color:lime;width:600px;opacity:.5"/>
<button onclick="webSearch()" style="border-radius:12px; font-size:48px"><strong>Go</strong></button>
<script>
function webSearch() {
let input = document.getElementById('urlInput').value.trim();
if (!input) return;
// If no protocol is provided, default to https://
if (!/^https?:\/\//i.test(input)) {
input = 'https://' + input;
}
window.open(input, '_blank');
}
document.getElementById('urlInput').addEventListener('keypress', function (e) {
if (e.key === 'Enter') {
openingInNewTab();
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment