1

I want to open new page by javascript and send data to that new page , i used this location.replace("test.php?data=123") but problem is I want my data be hidden, I know I should use post but i can't use post with location.replace do you have any idea?

MRE
  • 37
  • 7

1 Answers1

0

You can do this with the session-storage API

You can save any data as string (the key and the value must also be a string)

Old page:

sessionStorage.setItem('data', '123')

new page:

const data = sessionStorage.getItem('data')
data === '123'
tomitheninja
  • 497
  • 2
  • 13