The modern way Using window.get Screen Details() To make sure your browser supports the get Screen Details() method, first check if it exists on the window object.