blob: 063d901da9c18d7a50648b85d7311c2d620d94c6 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
function load() {
window.webkit.messageHandlers.fullscreenStateChangeHandler.postMessage('load');
}
document.addEventListener('webkitfullscreenchange', function(event) {
window.webkit.messageHandlers.fullscreenStateChangeHandler.postMessage('fullscreenchange');
});
document.addEventListener('mousedown', function(event) {
// Toggle fullscreen
var target = document.getElementById('target');
if (document.webkitFullscreenElement == target)
document.webkitExitFullscreen();
else
target.webkitRequestFullScreen();
});
</script>
<style>
#target {
background-color: red;
width: 150px;
height: 150px;
}
</style>
</head>
<body onload="load()">
<div id="target"></div>
</body>
</html>