0

How to prevent my website from opening in android's browser desktop mode?

I want that if someone enables desktop mode in Android's browser, e.g Chrome, then also the webpage should look exactly the same as it was in mobile phone mode(responsive mode). In short, I want my website to always open in responsive mode irrespective of the mode used in Android's browser. Suggest me some way to achieve it.

8th Aug 2020, 3:16 PM
Shashank Shekhar
Shashank Shekhar - avatar
3 Réponses
+ 1
Ok just wrap all tag inside a div and fix its width in px (= mobile width) ; Don't set in % or em. And that's all. Hope it will work.
9th Aug 2020, 12:13 PM
Divya Mohan
Divya Mohan - avatar
0
I thought of this before but the problem with this is that, let's say a case where I fixed the width 300px. and some user opens the website on a device which has viewport of 500px. Also, think of a case where I fixed the width 500px and the viewport is 300px.
9th Aug 2020, 3:11 PM
Shashank Shekhar
Shashank Shekhar - avatar
0
But you want to open it on mobile view isn't it . Ok try with js if you know. window.innerWidth Or With screenWidth If it is less than let's say 400px( ~widest mobile view) then width =100% and if screenWidth >400px Then width=400px ; So now adjustable for all mobiles and mobile view for tablets and desktop
9th Aug 2020, 3:17 PM
Divya Mohan
Divya Mohan - avatar