Reputation: 31
I have an HTML page designed with Bootstrap and I want to render it as desktop view and mobile view in a desktop browser. For example there are two buttons in page named DESKTOP
and MOBILE
, when user clicks on DESKTOP
button, page should reload as DESKTOP VIEW
and when user clicks on MOBILE
button, page should reload as MOBILE VIEW
. I tried this implementing using viewport
and also using ResponsiveViewPort. but didn't get any good result. It will be very useful if anyone can direct me to a correct path.
Upvotes: 0
Views: 2994
Reputation: 11759
One alternative that wouldn't require any special coding from you would be the Device Toolbar in Chrome. Hit F12 and then click the icon in the upper left that looks like a tablet and phone.
This will open a bar across the top and adjust the viewport accordingly.
You can pick from one of the default devices or use Edit... to create your own. (There's also a much larger list of default ones that aren't selected to appear in the menu.) There are a bunch of other preferences in there too.
Although there's no good alternative for testing on actual devices, this will give you a pretty good idea of how the site will look on different device sizes.
Note too that every device varies slightly in screen size and resolution, which is a detail that just creating a special viewport wouldn't show for you. You could certainly create a viewport that has the characteristics of a common device, but you wouldn't see exactly the same layout on a different device.
Other browsers have similar capabilities:
Upvotes: 1