[英]JavaScript disabled: how to show different messages for mobile and desktop.
I need to display different messages for desktop and mobile web sites when JavaScript is disabled. 禁用JavaScript时,我需要为台式机和移动网站显示不同的消息。
Currently I have 目前我有
<noscript>
<meta http-equiv="Refresh" content="0; URL=/error.html" />
</noscript>
and i need code that would do (i use pseudocode) 而且我需要可以做到的代码(我使用伪代码)
<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>
Thanks 谢谢
Is there any server backend to your website? 您的网站是否有服务器后端? You could try and do mobile browser detection based off of the user-agent received from the connecting browser. 您可以尝试根据从连接浏览器接收到的用户代理进行移动浏览器检测。
See this stackoverflow post about using the user agent to detect mobile. 请参阅有关使用用户代理检测移动设备的stackoverflow帖子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.