-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurl-encode-decode.html
87 lines (85 loc) · 2.97 KB
/
url-encode-decode.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="URL Encode/Decode tool to encode and decode URLs with ease.">
<meta name="keywords" content="URL, encode, decode, URL encoding, URL decoding">
<meta name="robots" content="index, follow">
<meta name="author" content="Utkarsh Patel">
<link rel="canonical" href="/url-encode-decode.html">
<title>URL Encode/Decode</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto', sans-serif;
background-color: #FAF8FF; /* background */
color: #1A1B20; /* onBackground */
margin: 20px;
}
.container {
max-width: 710px;
margin: 0 auto;
background-color: #FFFFFF; /* surfaceContainerLowest */
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* shadow */
}
textarea {
width: calc(100% - 20px);
height: 100px;
margin: 10px 0;
padding: 10px;
border: 1px solid #E1E2EC; /* surfaceVariant */
border-radius: 4px;
background-color: #FAF8FF; /* surface */
color: #1A1B20; /* onSurface */
resize: none;
font-family: 'Roboto', sans-serif;
}
button {
margin: 5px;
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 4px;
cursor: pointer;
color: #FFFFFF; /* onPrimary */
font-family: 'Roboto', sans-serif;
font-weight: 500;
}
.encode-btn {
background-color: #465D91; /* primary */
}
.decode-btn {
background-color: #575E71; /* secondary */
}
button:hover {
opacity: 0.9;
}
</style>
</head>
<body>
<div class="container">
<h1>URL Encode/Decode</h1>
<textarea id="inputText" placeholder="Enter text here..."></textarea>
<br>
<button class="encode-btn" onclick="encodeText()">Encode</button>
<button class="decode-btn" onclick="decodeText()">Decode</button>
<br>
<textarea id="outputText" placeholder="Result will appear here..."></textarea>
</div>
<script>
function encodeText() {
const input = document.getElementById('inputText').value;
const encoded = encodeURIComponent(input);
document.getElementById('outputText').value = encoded;
}
function decodeText() {
const input = document.getElementById('outputText').value;
const decoded = decodeURIComponent(input);
document.getElementById('inputText').value = decoded;
}
</script>
</body>
</html>