-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
37 lines (34 loc) · 1.09 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
<script>
// Init screen resolution
fetch('https://' + GetParentResourceName() + '/screenResolution', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
width: screen.width,
height: screen.height,
})
});
// Detect screen resolution changes
let previousWidth = screen.width;
let previousHeight = screen.height;
window.addEventListener('resize', () => {
const currentWidth = screen.width;
const currentHeight = screen.height;
if (currentWidth !== previousWidth || currentHeight !== previousHeight) {
previousWidth = currentWidth;
previousHeight = currentHeight;
fetch('https://' + GetParentResourceName() + '/screenResolution', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
width: currentWidth,
height: currentHeight,
})
});
}
});
</script>