Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Passing array variable invisibly to 2nd script
Old 05-27-2009, 01:30 PM Passing array variable invisibly to 2nd script
Average Talker

Posts: 21
Trades: 0
Here’s the problem.

I have a page with some JS code that populates an array variable with some names.
I want to access the array with some additional code on another page but I want to hide the original code so that a visitor can not use View Source to see all the names.

I suppose the question could be rephrased as how can I pass variable data from one JS script to another keeping the data invisible?

Suggestions will be greatly appreciated
jimandy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-27-2009, 01:57 PM Re: Passing array variable invisibly to 2nd script
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
The only way I can think to keep it totally invisible, or at least almost invisible, is to pass the data to the server, save it in the database with a session ID of some sort (a single unique cookie), then retrieve it via an AJAX call.

The only other thing that could be done is put all of the data into cookies, which isn't really invisible since these may be read by any user who knows how. However, if you're ok with this, you could put an array into one cookie (assuming there's not tons of data), by separating each item with a comma or some other delimiter, then using the split method to make it back into an array on the other page.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 05-27-2009, 02:10 PM Re: Passing array variable invisibly to 2nd script
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
To make data available across page navigations your options are:
  • to store it on the server, as mentioned by Abel
  • serialize and store in a cookie
  • use DOM Storage
  • or use something like Dojo Storage (note: this uses flash)
  • store in the clipboard
they've all got advantages and disadvantages and certain browser dependencies.
__________________

Please login or register to view this content. Registration is FREE

willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 05-28-2009, 11:08 AM Re: Passing array variable invisibly to 2nd script
Average Talker

Posts: 21
Trades: 0
Thanks for these suggestions. The DOM storage idea looks like a good possibility and I'll explore it further.
jimandy is offline
Reply With Quote
View Public Profile
 
Old 05-28-2009, 12:38 PM Re: Passing array variable invisibly to 2nd script
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
For Internet Explorer, as far as I know, DOM storage is only supported in version 8. So I don't think this is actually a viable option yet.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to Passing array variable invisibly to 2nd script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15216 seconds with 12 queries