简体   繁体   中英

Hiding dynamically created Javascript arrays

Is it possible to hide dynamically created arrays from the page source? I mean, when a user does a "view page source", he should not see all the values of the javascript array (looks quite ugly, not to mention the answers are visible).

Here is what I am doing:

  1. Fetch the data from DB (eg multiple questions)
  2. Create the javascript array with the questions
  3. Use javascript to cycle through the questions one at a time

There are 4 reasons for doing this:

  1. There should be zero lag between the questions (doesnt matter if it takes some time to load all the questions)
  2. There are shared variables (eg a countdown timer) between the questions
  3. Each question maybe "reviewed" immediately (hence the need for the correct answers).
  4. All the questions and the user answers are again displayed for review at the end.

Is there are better way of doing that than what I am doing? I think there should be.

如果您使用Ajax来获取数据,那么那些查看“页面源”的人将看不到它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM