-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathlocationObject.html
38 lines (38 loc) · 1.48 KB
/
locationObject.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
<head>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script>
function GetDetails() {
document.getElementById("server").innerHTML= location.host;
var loc;
if(location.protocol=="http:") {
loc = "You are using Web Server";
} else if(location.protocol=="file:") {
loc = "You are using File Server";
}
document.getElementById("protocol").innerHTML= location.protocol + "<br>" + loc;
document.getElementById("url").innerHTML= location.href;
document.getElementById("path").innerHTML= location.pathname;
}
</script>
<body>
<div class="container">
<h2>Location Object</h2>
<div class="form-group">
<button onclick="GetDetails()" class="btn btn-primary">Get Client Location</button>
<button onclick="location.reload()" class="btn btn-success">Refresh</button>
</div>
<div class="form-group">
<dl>
<dt>Server / IP</dt>
<dd id="server"></dd>
<dt>Protocol</dt>
<dd id="protocol"></dd>
<dt>URL</dt>
<dd id="url"></dd>
<dt>Path</dt>
<dd id="path"></dd>
</dl>
</div>
</div>
</body>
</head>