i used screen.width to get the width of the browser. it worked fine with iphone safari but didn't work in android phone(it showed 800 width for android browser).
Is there any compatible way to get the screen width. I dont want to use UserAgent to check if its mobile browser. would like to use a javascript for that and logic should include screen width.
It's know issue - see here
When page first loads the screen.width
and screen.height
are wrong.
Try a timeout like this:
setTimeout(CheckResolution, 300);
Where CheckResolution
is your function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With