Kasarn Doungprateep
Posts: 0
Joined: Wed Dec 11, 2013 12:49 pm

Combine Local Storage Variable with URL

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;

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Combine Local Storage Variable with URL

Hi Kasarn,

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

Kasarn Doungprateep
Posts: 0
Joined: Wed Dec 11, 2013 12:49 pm

Combine Local Storage Variable with URL

Hi Katya,

Is this syntax corrected ?

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

Kasarn Doungprateep
Posts: 0
Joined: Wed Dec 11, 2013 12:49 pm

Combine Local Storage Variable with URL

all done. Thank you ! :)

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Combine Local Storage Variable with URL

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

Return to “Issues”