-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
44 lines (44 loc) · 1.44 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>URL Shortener</title>
<link rel="stylesheet" href="/app/static/style.css" />
</head>
<body>
<main>
<h1>URL Shortener</h1>
<noscript>
<p>Please enable JavaScript for the best experience.</p>
</noscript>
{{if .Error}}
<p class="error">{{.Error}}</p>
{{end}}
<form id="shorten-form" action="/app/shorten" method="post">
<label for="url-input">Enter URL to shorten:</label>
<input
id="url-input"
type="url"
name="url"
placeholder="https://example.com"
required
/>
<button type="submit">Shorten</button>
</form>
{{if .ShortURL}}
<p>Shortened URL: <a href="{{.ShortURL}}">{{.ShortURL}}</a></p>
{{end}}
</main>
<script>
// Clear the URL parameters after displaying the short URL or error
if (window.history.replaceState) {
window.history.replaceState(
null,
null,
window.location.pathname
);
}
</script>
</body>
</html>