Skip to content

Commit 41ada26

Browse files
committed
Auto-resize pages when embedded in an iframe
1 parent 3d938fa commit 41ada26

10 files changed

Lines changed: 27 additions & 1 deletion

data-science-research.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,5 +254,6 @@ <h4>HAAG</h4>
254254
<div class="gt-footer-bottom">&copy; 2026 Georgia Institute of Technology &middot; Human-Augmented Analytics Group</div>
255255
</footer>
256256

257+
<script src="embed-resize.js" defer></script>
257258
</body>
258259
</html>

embed-resize.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// When this site is shown inside an iframe, report the page height to the
2+
// parent so it can size the frame to fit (used by the GT WordPress embed).
3+
(function () {
4+
if (window.parent === window) return;
5+
var lastHeight = 0;
6+
function send() {
7+
var height = Math.ceil(
8+
Math.max(document.body.scrollHeight, document.body.getBoundingClientRect().height)
9+
);
10+
if (height === lastHeight) return;
11+
lastHeight = height;
12+
window.parent.postMessage({ type: "haag-embed-height", height: height }, "*");
13+
}
14+
new ResizeObserver(send).observe(document.body);
15+
window.addEventListener("load", send);
16+
send();
17+
})();

faculty-affiliates.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,5 +289,6 @@ <h4>HAAG</h4>
289289
<div class="gt-footer-bottom">&copy; 2026 Georgia Institute of Technology &middot; Human-Augmented Analytics Group</div>
290290
</footer>
291291

292+
<script src="embed-resize.js" defer></script>
292293
</body>
293294
</html>

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,5 +376,6 @@ <h4>HAAG</h4>
376376
<div class="gt-footer-bottom">&copy; 2026 Georgia Institute of Technology &middot; Human-Augmented Analytics Group</div>
377377
</footer>
378378

379+
<script src="embed-resize.js" defer></script>
379380
</body>
380381
</html>

people.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,5 +379,6 @@ <h3>${escapeHtml(f.title)}</h3>
379379

380380
loadPeople();
381381
</script>
382+
<script src="embed-resize.js" defer></script>
382383
</body>
383384
</html>

phd-postdoc.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,5 +231,6 @@ <h4>HAAG</h4>
231231
<div class="gt-footer-bottom">&copy; 2026 Georgia Institute of Technology &middot; Human-Augmented Analytics Group</div>
232232
</footer>
233233

234+
<script src="embed-resize.js" defer></script>
234235
</body>
235236
</html>

project-explorer.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,5 +928,6 @@ <h4>HAAG</h4>
928928
</div>
929929
<div class="gt-footer-bottom">&copy; 2026 Georgia Institute of Technology &middot; Human-Augmented Analytics Group</div>
930930
</footer>
931-
</body>
931+
<script src="embed-resize.js" defer></script>
932+
</body>
932933
</html>

project-management.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,5 +232,6 @@ <h4>HAAG</h4>
232232
<div class="gt-footer-bottom">&copy; 2026 Georgia Institute of Technology &middot; Human-Augmented Analytics Group</div>
233233
</footer>
234234

235+
<script src="embed-resize.js" defer></script>
235236
</body>
236237
</html>

recruitment.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,5 +447,6 @@ <h4>HAAG</h4>
447447

448448
loadStatus();
449449
</script>
450+
<script src="embed-resize.js" defer></script>
450451
</body>
451452
</html>

team-matching.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,5 +253,6 @@ <h4>HAAG</h4>
253253
</div>
254254
`).join("");
255255
</script>
256+
<script src="embed-resize.js" defer></script>
256257
</body>
257258
</html>

0 commit comments

Comments
 (0)