Showing full (desktop view) website on devices with particular viewport (e.g. lower than 320px)?

流过昼夜 提交于 2019-12-07 15:06:34

Well, I had to find a solution for this, since my customer kept on insisting. So I've used a little piece of JavaScript/jQuery in order to change the content of 'viewport' meta. Here it is:

var myViewport = document.querySelector("meta[name=viewport]");

    if ($(window).width() < 320){
    myViewport.setAttribute("content", "width=1024; user-scalable = yes");
    } else {
    myViewport.setAttribute("content", "width=device-width; initial-scale = 1.0");
} 

Actually, I have no idea how legal this is, but it works and I've decided to answer my own question, in case any of you guys comes across this weird requirement in future.

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