1

I have a page where the user inputs a list of (potentially) thousands of strings, which then leads to a page that uses this list. I tried to just use a query parameter to pass the strings to the latter page, but according to another StackOverflow post that would exceed several browsers' URL length limits, although it worked just fine on Chrome, Firefox and Safari when I tested it. Are there any alternatives to passing massive a query parameter?

Note: One alternative would be to switch to a single-page app but I'd like to avoid that much complexity if it's possible.

Community
  • 1
  • 1
quadrupleslap
  • 400
  • 5
  • 17

2 Answers2

2

URL has a length limit which is not standardized. It depends on which browser and which version of the browser you're using. You're probably safe with about 2000 characters of total URL length.

If you want to avoid that, instead of issuing a GET request to a different page, you should create a POST request which has no limits.

The other alternative is using SPA where you're not actually sending anything over the HTTP and send the data in-memory instead.

Ivan Ferić
  • 4,675
  • 11
  • 35
  • 46
0

Save the data in localstorage or some client db like indexedDB, then retrieve it on the other page.

Angels
  • 220
  • 1
  • 8