You can’t (and really shouldn’t ) block the rotation. But why not detect the orientation and display a message asking the user to use a certain orientation.
if (window.innerHeight < window.innerWidth) { // portrait orientation
// show a message that asks the user to use landscape mode
myElement = document.getElementById('ELEMENT_ID')
myElement.innerHTML = "Please use Landscape Orientation";
}