Retrieving the URL from the localstorage

Hey All,

I am using local storage to store the URL name in the following manner :

localStorage.setItem("homeURL", homeURL);

and retrieving it in the following manner in another JS page of my single page application:


I can see the URL printing in my console.

Now, I want to bind the URL with the on click handler when a user clicks on a button like the following:

                alert('button clicked');

I can see the alert showing up on button click, however, I am wondering how should I get the URL that will work when a button is clicked?


Try this:
var url = localStorage.getItem("homeURL"); alert(url);

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.