How to force desktop view on mobile devices - Bootstrap?

66,292

Solution 1

Thanks All,

This code works for me:

var viewMode = getCookie("view-mode");
if(viewMode == "desktop"){
    viewport.setAttribute('content', 'width=1024');
}else if (viewMode == "mobile"){
    viewport.setAttribute('content', 'width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no');
}

Solution 2

You just need to set the Viewport

<meta name="viewport" content="width=1024">

Instead of this (Responsive version)

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Look at here. Should solve your issue.

SO - bootstrap-3-desktop-view-on-a-mobile-device

SO - how-to-show-desktop-version-on-mobile-screens-in-bootstrap-3

Solution 3

As for me I use this one I set the initial viewport scale to 0.1

<meta name="viewport" content="width=device-width, initial-scale=0.1">

Solution 4

  • The best way is to either sent content empty i.e.

    name="viewport" content=""

or

  • Take a variable to have the screen width so that it can work on all the screen sizes

    name="viewport" content="width= {screenWidth}"

Share:
66,292
Sandeep
Author by

Sandeep

Updated on July 11, 2022

Comments

  • Sandeep
    Sandeep almost 2 years

    How do i force desktop view on mobile devices with Bootstrap?

    I have tried fixing the viewport width to 1024, but still it doesn't work me.

    Any Advices?