This script uses binary search to find the exact character length the local storage can hold. It only takes a few seconds.

Note: Sometimes the local storage does not get cleared properly. In that case reload the page a few times. You can follow the progress in the console.