-
-
Save saas786/1bce3115650cf853a0049836bfd5e73c to your computer and use it in GitHub Desktop.
Javascript get string size. i.e. Cookie size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getByteSize(s) { | |
return encodeURIComponent('<q></q>' + s).length; | |
} | |
getByteSize(document.cookie); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment