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?
Asked
Active
Viewed 911 times
1

MRE
- 37
- 7
-
Send it with base64_encode and then, you recieve that and base it back base64_decode – Fernando Torres Nov 10 '19 at 18:50
-
Does this answer your question? [window.location.replace - POST version?](https://stackoverflow.com/questions/31911053/window-location-replace-post-version) – nbk Nov 10 '19 at 18:54
-
1You can save it in session, cookie, loca.storage, and use that on other page. – Serghei Leonenco Nov 10 '19 at 19:13
1 Answers
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