-
Notifications
You must be signed in to change notification settings - Fork 3
/
resize.htm
35 lines (34 loc) · 892 Bytes
/
resize.htm
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
<html>
<head>
<title>Testing lti.frameResize</title>
</head>
<body>
<h1>Testing lti.frameResize</h1>
<p>
This script sends the "lti.frameResize" to its parent
frame using <b>parent.postMessage()</b> to sneak across
origins. You can just link to this file with any
key and secret to test the behavior.
</p>
<script>
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
function zap() {
var num = getRandomInt(200,800);
console.log("Sending "+num);
parent.postMessage(JSON.stringify({
subject: "lti.frameResize",
height: num
}), "*");
}
function ref() {
console.log("Refresh");
parent.postMessage(JSON.stringify({
subject: "lti.pageRefresh"
}), "*");
}
</script>
<button onclick="zap();return false;" value="click">Press to Send Random Height</button><br/>
<button onclick="ref();return false;" value="click">Refresh</button><br/>
</body>