how to know if someone is logged via javascript?

前端 未结 4 1365
渐次进展
渐次进展 2021-01-03 08:43

in php i would do

if (isset($_COOKIE[\'user\']) && $_COOKIE[\'user\'] == $valueFromDb)
 echo \'logged\';

But in javascript how can

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-03 09:30

    You are mixing up server-side processing (php) with client side processing (javascript). On the client side this information does not exist unless the server has provided it in some framework-specific way.

提交回复
热议问题