Check whether Javascript is enabled

后端 未结 9 2106
礼貌的吻别
礼貌的吻别 2020-12-29 13:47

Is there a way to check whether Javascript is enabled or supported by the browser? If it\'s not supported, I would like to redirect the user to a user-friendly error page. <

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-29 13:56

    Whether or not javascript is enabled is only known from within the context of a browser, so the best you can do is write some browser-side code to set a flag based on if javascript is enabled or not. One possibility is do something like

    
    

    and

    // contents of javascript_disabled.php
    $_SESSION['javascript_disabled'] = 1;
    

提交回复
热议问题