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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to hide Javascript on View Source

Status
Not open for further replies.

devondago

Programmer
Jan 22, 2003
38
US
Hi
I am buiding a form and I wanted to respond to the user if they have the right answer or not...I want to use javascript for this however I know that a user that maybe aware of view source will simply go to that. Can I do something to hide this?
 
Well, you could just make a external javascript. The problem with this is anyone can still download the external script. But, you would be best off to use PHP or something. That would make it virtually impossible for the users to get the answers. I don't know if that is an option for you or not, but it might be worth looking into...
 
thanks for the imput. I am doing this in CF and the javascript comes in form of the replies. Any other suggestions you may have would shure help.
 
To disable view source, use this:
Code:
<script>
<!--
document.oncontextmenu = new Function(&quot;return false&quot;);
//-->
</script>
 
I'd like to know that too, but the above code didn't work. I tried taking the quote marks out too. Rob
Just my $.02.
 
Hmm.. I thought it worked in Netscape but maybe not. If you're using IE, you typed it wrong.
 
That might stop the right-click and view source but what about if you simply use the IE toolbar View -> Source ?

Ronald
 
Nothng helpes, even if you disable clicking on the document and don't show the menu bar (use modeldialog):

in the parent:
this in onload:
var aa = &quot;&quot;;
aa = window.showModalDialog(&quot;secure.htm&quot;,null,&quot;dialogHeight:344px;dialogWidth:468px;help:0;resizable:0;scroll:0;status:0&quot;);
window.location.replace(&quot;go somewhere else now&quot;);
..

Still I can put the parent that opens the showmodaldialog in a href like this: <a href=&quot;you think this is a secure parent&quot;>...</a>
Open that page and rightclick the href choose save tartet as.
then I would find out the url to the modal dialog and do the same even if you have disabled all clicking in the page after I saved the target I can just open your html page in notepad.

My suggestion is: please write a page that deals with large sums of money and send me the URL.
 
If your using CF then why not do it the CF way then the JS way?? Have the answers in an Access dB then using SQL call the right answer, this way when the user goes to view source its hidden cause the browser doesn't show server-side scripts...
Know what I mena?? I have not failed; I have merely found 100,000 different ways of not succeding...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top