PDA

View Full Version : Prevent client seeing html source code


Sscotties
10-11-2002, 07:28 PM
Just like to apologise first: I did try and search this first.

I have an on-line quiz web application, that receives data from web page parameters. Not at all useful, if the user finds the answers by looking 'behind the scenes'. I think this is a job for JAVASCRIPT.

Could some kindly person give me the (most robust) line or two of code to do this ...please.

Thanks for taking the time to read my question.

whammy
10-11-2002, 08:10 PM
There's no way to hide any client-side code (even using javascript), if the person looking for it knows what they're doing.

If they aren't TOO savvy, you can put the javascript in an external .js file and include it into the page... see:

http://www.javascriptkit.com/javatutors/external.shtml

But the only way to truly be safe would be to calculate the correct answers using a server-side scripting language like ASP, PHP, or something using CGI...

Sscotties
10-12-2002, 12:50 AM
Excellent:

Why didn't I think of the include statement!?


Great work! you're a star.

whammy
10-12-2002, 01:19 AM
:cool: