-
Notifications
You must be signed in to change notification settings - Fork 64
/
test_access.html
73 lines (58 loc) · 1.76 KB
/
test_access.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
<html>
<head>
</head>
<body>
<h3>Access test</h3>
<pre>
<span id="output_span"></span>
</pre>
<br/>
<pre>
<span id="output_span2"></span>
</pre>
<br/>
<script>
function do_access_test()
{
var str = '';
str += 'window.location.hash: ' + window.location.hash + '\n';
str += 'window.location.host: ' + window.location.host + '\n';
str += 'window.location.hostname: ' + window.location.hostname + '\n';
str += 'window.location.href: ' + window.location.href + '\n';
str += 'window.location.origin: ' + window.location.origin + '\n';
str += 'window.location.parthname: ' + window.location.parthname + '\n';
str += 'window.location.port: ' + window.location.port + '\n';
str += 'window.location.protocol: ' + window.location.protocol + '\n';
str += 'window.location.search: ' + window.location.search + '\n';
document.getElementById('output_span').innerHTML = str;
///////////////////////////////////////
var url = 'https://oreilly-qc.github.io/test_access.html';
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4)
{
str = '';
str += 'status: ' + xhr.status + '\n';
if (xhr.status == 200)
{
str += 'access granted.\nGreetings Professor Falken.\n\n';
str += xhr.response;
}
else
{
str += 'access denied.\n';
}
document.getElementById('output_span2').innerHTML = str;
}
}
xhr.open("GET", url, true);
xhr.setRequestHeader('Content-Type', 'text/html');
xhr.send(JSON.stringify({
language: 'js',
draw: '1',
}));
}
do_access_test();
</script>
</body>
</html>