简体   繁体   English

在桌面网站内显示移动网站

[英]show mobile website inside a desktop website

Hi I would like show a mobile version website in my website on a desktop computer, how I can do it? 嗨,我想在台式机上的网站上显示一个移动版本的网站,我该怎么做?

  • I was thinking using an iframe, but they show me the desktop version inside the iframe. 我当时在考虑使用iframe,但是它们向我展示了iframe内的桌面版本。

  • I tried to change the user-agent of the iframe but doesn't work for me (maybe is possible) 我试图更改iframe的用户代理,但对我不起作用(也许是可能的)

  • I don't want use chrome inspector to achieve this. 我不想使用chrome inspector来实现这一目标。
  • I don't want use version like m.website.com because I don't know how to generate all the different URL 我不想使用m.website.com之类的版本,因为我不知道如何生成所有不同的URL
  • I prefer a client solution without server if is possible 如果可能,我更喜欢没有服务器的客户端解决方案
  • If there is a solution out of the box I'll love have some working code 如果有开箱即用的解决方案,我会喜欢一些有效的代码

(for instance you can try https://www.linguee.it/ ) Thanks (例如,您可以尝试https://www.linguee.it/ )谢谢

here you can see the problem <iframe src="https://codepen.io" id="frame_1"></iframe> https://codepen.io/orlandoangular/pen/qQXPob 在这里您可以看到问题<iframe src="https://codepen.io" id="frame_1"></iframe> https://codepen.io/orlandoangular/pen/qQXPob

Add view port in header section like this: 在标头部分添加查看端口,如下所示:

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

Use Media Query in your css like this: 像这样在CSS中使用Media Query:

body {
    background-color: pink;
}

@media screen and (max-width: 480px) {
    body {
        background-color: lightgreen;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM