Is there a way to give the user an option to view the desktop version if they are viewing on a phone or tablet?

谁说我不能喝 提交于 2019-12-11 03:06:42

问题


I know that TB is supposed to give optimized versions of content depending on the device, but I do like the idea of giving the user control over how they view the site (i.e. give them the choice to view desktop version if they want it).


回答1:


You could load in different CSS (no media queries) if desktop view link is clicked or based on user agent.

If you want to have a link to view desktop version, you could just append a GET/URL variable that causes your site to load in without media query CSS or with only a few large width media queries.

If you wanted to utilize the 'Request Desktop Site' feature in Chrome/Android browsers to serve the desktop version, you would need to go the user agent route.

For example 1. Check user agent for mobile 2. If not mobile, don't load media query CSS 3. If mobile, load media query CSS to enable the responsive layout

This does take away from the ability of responsive layouts to adapt to different size monitors or non-mobile alternative devices, rendering responsive only for mobiles.

Either way you'll need some logic to hangle the CSS switching. If using URL variables to control desktop view you could do this pretty easily with a JavaScript snippet. User agent sniffing is a bit uglier and best done with your native programming language.




回答2:


Short answer would be no. Twitter bootstrap is built around a fluid/responsive grid that scales to the size of the device your site is being viewed on.

To accomplish what you want, you would build a separate mobile version of the site and direct users on mobile devices there with an option at the bottom of the page to view the full site.




回答3:


There is an easier way to force the desktop-version. You only have to give the body-tag a min-width.

For example:

 body {
   min-width: 1100px;
}

That's all! Have fun!



来源:https://stackoverflow.com/questions/13406610/is-there-a-way-to-give-the-user-an-option-to-view-the-desktop-version-if-they-ar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!