Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrive value from comment tags

Status
Not open for further replies.

parazite

Technical User
Feb 1, 2011
2
CA
I would like to store information (like values of an input form) in a way to retrieve it later. I don't want to use cookies and I do not have a database. What options do I have?

I was thinking the best will be to write it on the page inside comments tags. For example:

<!--MYVALUE1=50-->
<!--MYVALUE2=100-->

I do not have problems writing it with javascript, but I do have a problem retrieving the information. Does anybody know how can I retrieve consistently information stored this way?

 
You can't. Anything you write to a page with JS will disappear the next time the page is loaded because you aren't actually altering the page, rather just the temporary in memory page. That is not a good way to store information.

That's what cookies are for. Why not do it the easy way, instead of trying to invent some other storage method that does not exist.

Besides if you store it in the actual page by editing the source, it will be the same value for any and all visitors to the page which may not be desirable.





----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Hi

parazite said:
I don't want to use cookies and I do not have a database.
If client-side storage is good enough, take a look at Web Storage.

But note that it is quite new technology :
Wikipedia said:
It is supported by Internet Explorer 8, Mozilla-based browsers (e.g., Firefox 2+, officially from 3.5)[sup][2][/sup], Safari 4, Google Chrome 4 (sessionStorage is from 5), and Opera 10.50. As of 14 July 2010 only Opera supports the storage events[sup][3][/sup].
( Web Storage article on Wikipedia. )

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top