簡體   English   中英

禁用JavaScript:如何在移動設備和台式機上顯示不同的消息。

[英]JavaScript disabled: how to show different messages for mobile and desktop.

禁用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>

謝謝

您的網站是否有服務器后端? 您可以嘗試根據從連接瀏覽器接收到的用戶代理進行移動瀏覽器檢測。

請參閱有關使用用戶代理檢測移動設備的stackoverflow帖子。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM