Hi there,
So far I couldn't find any trick to prevent users from viewing the html source code. There were some silly solutions like usin' frames, and corruptin' mouse right-click event.
Is there anybody has a powerful and logical solution?
In the second page (test2), encapsulate every line of HTML with the document.write command:
document.write("This Is Test 2"
You can use CF to dynamically build this second page:
document.write("<cfset x = 'This Is Test 2'><cfoutput>#x#</cfoutput>"
When the user looks at the source to the first page, all they will see is the call to the second. The problem is that they will see the file name for the second page and could type it into the browser but you may able to use GetTemplatePath or something to make sure they aren't peeking.
I dont' think you can prevent users from viewing your HTML source.
IE's View Source command does not display HTML generated by document.write(..) but Netscape 4 does (I find this useful for debugging).
The user can always save the page and analyse it at leisure.
Even if you manage to disable these facilities, a smart user can find the code in the browser's cache directory.
The same goes for Javascript - I've seen "How can I protect my Javascript?" on dozens of forums and the answer is always "You can't".
Why bother about HTML source? The clever stuff you really want to safeguard is likely to be your CF code. If your server requires a password for FTP and you take good care of your password, your CF source should be pretty safe.
Alright Philcha,
I just wanna know how to hide the source code 'cos I wanna know. You should know that it's possible to disable the View > Source menu of the IE, but so far I don't know how. If you wanna make sure, just visit room33.com, login (you should login to see), and try to view the source code. You'll be surprised 'cos you won't be able to see any piece of code.
Thanx for payin' attention.
If you try it from Netscape the html is visible and if you turn off the Java on IE the html is visible. So without devoting the rest of my life to it I can confidently say it is a Java thing.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.