Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如果消费者在手机上,如何使用其他html文件?_Javascript_Html - Fatal编程技术网

Javascript 如果消费者在手机上,如何使用其他html文件?

Javascript 如果消费者在手机上,如何使用其他html文件?,javascript,html,Javascript,Html,因此,我遇到了一个问题idk如何让我的消费者看到我使用的移动html: 但由于某些原因,它不想工作。你有什么建议吗 if (screen.width <= 500) { document.location = "webapp.html"; } </script> ``` if(screen.width您是否尝试过使用window.location.href=“webapp.html”而不是您正在使用的内容 您也可以在页面加载之前尝试这种方法

因此,我遇到了一个问题idk如何让我的消费者看到我使用的移动html: 但由于某些原因,它不想工作。你有什么建议吗

    if (screen.width <= 500) {
    document.location = "webapp.html";
    } 
    </script> ```


if(screen.width您是否尝试过使用
window.location.href=“webapp.html”
而不是您正在使用的内容


您也可以在页面加载之前尝试这种方法。如果您使用PHP和CodeIgniter,您可以使用,并检测哪些设备正在进入页面,然后重定向到相应的页面。

只需使用css3 flexbox或
css框架,如bootstrap等。

您应该让您的站点具有响应性。--我只想在手机上安装一个其他应用程序,而不是在桌面上。您可以使用javascript的screen.width函数检索用户设备的宽度。然后根据此宽度,您可以使用window.location.replace重定向到相关页面(‘目的地’);