Skip to content

Tag: javascript

Detect scale settings (dpi) with JavaScript or CSS

I’ve noticed that a small laptop with a 1920×1080 screen, windows 10 will auto adjust the scaling. I’ve seen it as high as 150%. Is there a way we can detect this? My media queries don’t kick in as they’re set in px. Answer Try accessing window.devicePixelRatio variable. The Windo…

CORS error, but data is fetched regardless

I have a generated React site I am hosting in an S3 bucket. One of my components attempts to fetch something when loaded: The url I am fetching is an AWS API Gateway. I have enabled CORS there, via the dropdown, with no changes to the default configuration. In my console, for both the remote site and locally …

Build error while compiling create-react-app

I am new to Reactjs and am started learning it. I have been trying to start a basic hello world program but its failing at compilation level. Created a start up hello-word program with create-react-app hello-world it gave me a nice folder structure with bunch of files. And Here you can see the compilation err…