title: Dynamic variable through localStorage and url param
body: <p>I have a dynamic variable</p>
  
  <p>Example:</p>
  
  <pre><code>dynamic = "music1"
  </code></pre>
  
  <p>This variable is changing and I want to keep this variable using localStorage instead of a cookie:</p>
  
  <pre><code>localStorage.setItem('dynamic', dynamic)
  </code></pre>
  
  <p>I would like to use this variable as query parameter is the url contains in the url i.e. library.</p>
  
  <p>Example the current url is:</p>
  
  <p><code>www.domain.com/library</code> if in the storage exist a variable change the url to something like this:</p>
  
  <pre><code>www.domain.com/library?dynamic=music1
  </code></pre>