473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Hiding a part of an html page

I provide online tutorials for my students. Each page contains a question, which the student must answer. The answer is in javascript like this example:
Expand|Select|Wrap|Line Numbers
  1. corAns = 17
  2.  
I'd like to make it more difficult (I know I can't make it impossible) for the students to look at my code and extract the answer.

I could encrypt the entire page, but that seems like overkill. Is there a slick way to encrypt one line of code?
Nov 27 '11 #1

✓ answered by Rabbit

That wouldn't stop someone from going to the frame's location directly and pulling up the source that way.

You can disable the context menu but they can just click on view > source in their toolbar.

10 1495
omerbutt
638 512MB
Hi systomx,
why not you save the answers inside a text file and the read that file through AJAX to check the answer , although the preferred way is to save the answers inside a db and then use a AJAX call to the server side script(PHP, ASP) that connects to a database table to verify the answer against tat particular question
regards,
Omer Aslam
Nov 27 '11 #2
Rabbit
12,516 Expert Mod 8TB
Just hash the answer. Then hash the student's answer and compare the hashes.
Nov 27 '11 #3
omerbutt
638 512MB
Just hash the answer. Then hash the student's answer and compare the hashes.
the above method will allow to students to use the same hashing with the four options given as answers and the compare the resulting hash with the one saved in the page :D , i might do that if i was hid student [*evil*]
regards,
Omer Aslam
Nov 28 '11 #4
Rabbit
12,516 Expert Mod 8TB
It's the best they can do with their limitations.

If the answers are saved in a text file and then you use AJAX to retrieve the answers, the student can just use AJAX to retrieve the answers.

This is a repost, and in the other post, the OP said he can't use server side scripting. So that idea is out the window.
Nov 28 '11 #5
Thanks for your posts.

What I have now done is to include the following javascript code in an include file. The include file is called in the HEAD of each of the tutorial pages.
Expand|Select|Wrap|Line Numbers
  1. //Code to block access to context menu
  2. window.oncontextmenu = function() {return false;}
  3.  
This blocks right click for Google Chrome, Firefox, and Safari. It does not not work for IE8 or IE9. (Any comments on that?)

I realize that determined cheaters can get past this roadblock, even without using IE. Nevertheless, it will make it more difficult for them.

My tutorial pages make use of frames, and I have heard that right click access to page source can be redirected to the parent frame (which doesn't contain my answers). Is this possible? If so, how?
Nov 28 '11 #6
Rabbit
12,516 Expert Mod 8TB
That wouldn't stop someone from going to the frame's location directly and pulling up the source that way.

You can disable the context menu but they can just click on view > source in their toolbar.
Nov 28 '11 #7
Rabbit --

You said "You can disable the context menu but they can just click on view > source in their toolbar."

Well, yes and no. Using the tools menu/view source on Chrome, Firefox, and Safari shows the parent page (the frameset page), which doesn't have the answer.

Still, I realize that what I've got is not really a fix for the problem, but more of a deterrent.

(sigh) I may have to bite the bullet and directly edit my 200+ pages of html to obfuscate the answers.
Nov 29 '11 #8
Frinavale
9,735 Expert Mod 8TB
I would move the code to a server-side script and call the script via Ajax to make it smooth.
Nov 29 '11 #9
Rabbit
12,516 Expert Mod 8TB
This is a double post and in the original post, the OP said they can't use server side scripting.
Nov 29 '11 #10
Rabbit
12,516 Expert Mod 8TB
systomx, once they have the source of the parent page, it contains the url of the framed page. They just have to navigate directly to that frame page, which removes the frame, and view the source of that.
Nov 29 '11 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: deko | last post by:
Is it possible to call a php script from an html page? I have a TestPage.php that I want to convert to TestPage.html - but still call a php script from it. This is how my TestPage.php looks...
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
0
by: lbailor | last post by:
Hi, I am very new to xml and I'm trying to display a page that pulls fields from my xml file and displays them in a table in an html page. So far this part is working. However, I want my one field...
9
by: Glenn | last post by:
Is it possible to only redraw a portion of an HTML page as part of a request? With each request, I am updating number of results but do not want to lose where you were in a page. I created...
5
by: Earl Teigrob | last post by:
I am creating an application where I would like to give web designers the ablity to create a static html page and dyanamically load it into my application(exactly like loading a user control into a...
13
by: DH | last post by:
Hi, I'm trying to strip the html and other useless junk from a html page.. Id like to create something like an automated text editor, where it takes the keywords from a txt file and removes them...
7
by: SteveM | last post by:
I am sure this is an easy question, but being relatively new to ASP.NET programming, I can not quite grasp what I need to accomplish what I need to do. What I have is a word document that is...
17
by: =?Utf-8?B?Y2F0aGFyaW51cyB2YW4gZGVyIHdlcmY=?= | last post by:
Hello, I have build a website with approximately 30 html-pages. When I search this website in Google, I see the index.html or home.html on this website, but also other html-pages on this...
4
by: davidiwharper | last post by:
Hi everyone, I am rewriting a basic "email data to administrator" script to include an error check, which will ensure that all fields are filled with at least some data. However, there is a...
5
by: teddarr | last post by:
I have this product catalog. I am to scroll through the catalog on the HTML page and use data from the XML page to display the different products with a picture of each. I have the data and the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.