Setting localstorage values
|
07-18-2019, 10:04 AM
Post: #1
|
|||
|
|||
Setting localstorage values
Hello all
I am a novice to the WPT and I would like to know if there is a way to set localstorage in the browser session that loads the page Right now I have the script like this but it is not taking any effect setCookie xxx.xxx.com split_tcv=200 setCookie xxx.xxx.com __vst=d991880c-d603-41cb-b4ff-d6d11c8fd8b5 exec localStorage.setItem('recently_viewed', '1130217481,2267432533,1497137951,2441643263,1581060853,2267909440'); navigate https://XXX.XXX.com I also tried setCookie xxx.xxx.com split_tcv=200 setCookie xxx.xxx.com __vst=d991880c-d603-41cb-b4ff-d6d11c8fd8b5 exec window.localStorage.setItem('recently_viewed', '1130217481,2267432533,1497137951,2441643263,1581060853,2267909440'); navigate https://XXX.XXX.com |
|||
07-19-2019, 12:00 AM
Post: #2
|
|||
|
|||
RE: Setting localstorage values
You have to be on a page on the domain your are trying to write localstorage to before it will work. If you have a blank page you can host on the domain that would be best. There is no way to pre-populate the local storage before running a first-view test.
|
|||
07-19-2019, 10:01 AM
Post: #3
|
|||
|
|||
RE: Setting localstorage values
Thanks @pmeenan.
After I added another domain page navigation it is setting up local storage with intended values. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)