0

I have angular app and based on previous path name not page name i want to store the value either in cookie or local storage

Path name of first page is /content/drive.html/find-drive
Path name of second page is /content/drive.html/drive-results

When I am on the second page I want to store find-drive value in cookie

Similarly

Path name of first page is /content/drive.html/find-drive-advanced
Path name of second page is /content/drive.html/drive-results

When I am on second page i want to store the previous path location in my cookie or local storage.for this scenario i want to store"find-drive-advanced"

Note: document.referrer doesn't work, and window.parent.URl doesn't work

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • you can try the following solution https://stackoverflow.com/questions/36933673/how-can-i-retrieve-the-previous-url-in-angularjs – Ramesh Lamba Aug 29 '17 at 07:35

1 Answers1

0

Use localStorage

Say that url1 = '/content/drive.html/find-drive', and url2 = '/content/drive.html/drive-results'

just save them like so:

localStorage.setItem('url1', url1);
localStorage.setItem('url2', url2);

to retrieve the value, just write

var url1 = localStorage.getItem('url1');
Jaeger
  • 1,686
  • 1
  • 30
  • 50