【问题标题】:JavaScript disabled: how to show different messages for mobile and desktop.禁用 JavaScript:如何为移动设备和桌面显示不同的消息。
【发布时间】:2013-08-20 03:57:44
【问题描述】:

当 JavaScript 被禁用时,我需要为桌面和移动网站显示不同的消息。

目前我有

<noscript>  
    <meta http-equiv="Refresh" content="0; URL=/error.html" />
</noscript>

我需要可以做的代码(我使用伪代码)

<noscript>
    if desktop
    <meta http-equiv="Refresh" content="0; URL=/error.html" />
    if mobile
    <meta http-equiv="Refresh" content="0; URL=/mobile-error.html" />
</noscript>

谢谢

【问题讨论】:

  • 是否可以响应式设计error.html,使其在所有设备上看起来都不错?
  • 不行,需要显示不同的内容

标签: javascript noscript


【解决方案1】:

您的网站是否有任何服务器后端?您可以尝试根据从连接浏览器收到的用户代理进行移动浏览器检测。

this stackoverflow post about using the user agent to detect mobile.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-31
    • 2017-10-03
    • 2016-02-20
    • 2016-09-26
    • 1970-01-01
    • 1970-01-01
    • 2014-12-25
    • 1970-01-01
    相关资源
    最近更新 更多