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

StackOverflow https://stackoverflow.com/questions/18326731

  •  25-06-2022
  •  | 
  •  

سؤال

I need to display different messages for desktop and mobile web sites when JavaScript is disabled.

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top