<!DOCTYPE html>
<html>
<body>
<script>
var recordedOrientations = [];

screen.orientation.onchange = function() {
  recordedOrientations.push(screen.orientation.type);
};

window.addEventListener("message", function(event) {
  if (event.data == "report") {
    event.source.postMessage(recordedOrientations, "*");
  }
}, false);
</script>