forked from signalfx/splunk-otel-js-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
68 lines (52 loc) · 1.45 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<html>
<script src="./dist/splunk-otel-web.js"></script>
<script>
SplunkRum.init(
{ beaconUrl: 'http://127.0.0.1:9080/api/v2/spans', debug:true, allowInsecureBeacon: true, });
</script>
<p>Hi!</p>
<script>
console.log("hello");
function whenDone() {
console.log("whenDone");
}
function throwit() {
throw new Error('oh no');
}
function go() {
console.log("go");
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", whenDone);
oReq.open("GET", location.href, true);
oReq.setRequestHeader('Cache-Control', 'no-cache');
oReq.send();
fetch(location.href).then(function(response) {
console.log('fetch finished');
});
// causes unhandledrejection
Promise.resolve('ok').then(() => { throw new Error('pancakes!'); });
// 'normal' error chain
throwit();
}
setTimeout(go, 2000);
function clicky() {
console.log('clicky');
}
</script>
<a href="javascript:go()">Go again</a>
<a id="route" href="javascript:clicky()">Change name</a>
<a id="routeAfterFetch" href="javascript:clicky()">Change name after fetch</a>
<script>
document.getElementById("route").addEventListener('click', function() {
history.pushState({}, 'title', '/thisIsArtificiallySet');
});
</script>
<script>
document.getElementById("routeAfterFetch").addEventListener('click', function() {
fetch('page2.html').then(function(response) {
history.pushState({}, 'title', '/thisIsSetAfterFetch');
});
});
</script>
<img src="./doesnotexist.jpg">
</html>