0

Is there a better way using javascript to persist url query string throughout user session in client side other than using cookie?

url:

 http://site.com/?q=query
jake
  • 2,322
  • 1
  • 20
  • 31
bingjie2680
  • 7,356
  • 7
  • 41
  • 70
  • Can you elaborate what exactly you want to do? – Pekka Feb 06 '12 at 10:41
  • I would like to modify some content on pages based on the query, the problem is the landing page has the query string. but going to sequential pages will lose the query string. I can't touch the server side. – bingjie2680 Feb 06 '12 at 10:58

2 Answers2

0

There is no other way to do that in HTML4.

jake
  • 2,322
  • 1
  • 20
  • 31
amd
  • 18,048
  • 6
  • 45
  • 64
0

Use window.name property. It'll store any string you need. And then check the property value on other pages.

Works on older browsers too.

Samuli Hakoniemi
  • 16,628
  • 1
  • 55
  • 71