Hướng dẫn check cookie enabled javascript
Published January 27, 2021 To check whether a setting a cookie is enabled in the browser, you can use the See this example live in JSBin. Share on: Facebook
Twitter How to detect that JavaScript or Cookies are disabled in the user's browser and notify him any help ? asked Jan 5, 2011 at 10:59
Mahmoud SalehMahmoud Saleh 32.7k116 gold badges331 silver badges491 bronze badges 2 For checking cookies you can use:
And for checking JavaScript use a
answered Jan 5, 2011 at 11:01
robjmillsrobjmills 18.2k15 gold badges74 silver badges120 bronze badges 7 Update (6/25/18): A lot of these posts, including mine, are taking snippets from Modernizr. They will all eventually become outdated as the Modernizr code gets updated. I think the best answer to this question should be to use Modernizr directly.
Original Answer (5/11/17): This is taken straight from Modernizr and works in more browsers than other solutions in this post. https://github.com/Modernizr/Modernizr/commit/33f00fbbeb12e92bf24711ea386e722cce6f60cc
answered May 11, 2017 at 18:57
Noah SolomonNoah Solomon 1,20314 silver badges23 bronze badges As the cookie detection didn't work in IE 11, I suggest the Modernizr approach:
https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cookies.js
mcmimik 1,08912 silver badges29 bronze badges answered Jan 30, 2018 at 12:11
ZymotikZymotik 5,2643 gold badges36 silver badges46 bronze badges 3 Assuming JavaScript is enabled, this will tell you if cookies are enabled or not. Works in old browsers.
To display a message only when JavaScript is disabled use
answered Apr 8, 2019 at 23:49
PHP GuruPHP Guru 1,17710 silver badges17 bronze badges
answered Nov 1, 2015 at 18:30
3 This is the easiest way
GalAbra 4,8584 gold badges21 silver badges39 bronze badges answered May 1, 2017 at 3:28
NireshNiresh 1051 gold badge1 silver badge13 bronze badges 1 This function can view error message for users and also can stop script executing and it can return cookies status.
|