Page 1 of 1

Combine Local Storage Variable with URL

Posted: Thu Jan 09, 2014 7:50 am
by Kasarn Doungprateep

I would like to combine my Local Storage Variable with URL into a new URL.
and then navigate to the new URL. How can I?

For Example,

  1. Let say I have a local storage variable called Username.

  2. when click a submit button, it will run Javascripts for navigating users to this URL

    window.location = 'http://www.example.com/' + Username;


Combine Local Storage Variable with URL

Posted: Thu Jan 09, 2014 9:01 am
by Kateryna Grynko

Hi Kasarn,

Instead of codeUsername/code useprelocalStorage.getItem("Username")/pre


Combine Local Storage Variable with URL

Posted: Thu Jan 09, 2014 9:37 am
by Kasarn Doungprateep

Hi Katya,

Is this syntax corrected ?

window.location = "http://www.example.com"+ (localStorage.getItem("Username"))";


Combine Local Storage Variable with URL

Posted: Thu Jan 09, 2014 9:42 am
by Kasarn Doungprateep

all done. Thank you ! :)


Combine Local Storage Variable with URL

Posted: Thu Jan 09, 2014 9:43 am
by Kateryna Grynko

prewindow.location = "http://www.example.com"+ localStorage.getItem("Username")";/pre