Context teset

by boldtrn

HTML

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

<div id="output">

</div>

</body>
</html>

CSS

body {
  width: 100%;
  height: 100vh;
  
  user-select: none;
  
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

JavaScript

document.body.addEventListener('contextmenu', () => {
document.getElementById('output').innerHTML = 'contextmenu'
})

document.body.addEventListener('click', () => {
console.log('click')
document.getElementById('output').innerHTML = 'click'
})

document.body.addEventListener('touchstart', () => {
document.getElementById('output').innerHTML = 'touchstart'
})