devxlogo

Viewing Source Code

Viewing Source Code

Question:
Is there a way to prevent users from using the VIEW/SOURCE to view the HTML in my pages? I need to have this for a form that uses sensitive information in the VALUE field of a drop down menu, and I don’t want anyone to be able to just go in and view the source code to retrieve the values.

Answer:
There are a number of workarounds that can keep some people out of your source, but there is no way to keep all people out of your source.

If keeping 99% of the people out of your source is okay, you’ll want to (1) keep out all non-IE users, (2) keep out all non-Windows users, and (3) keep out all users without JavaScript. Then, you can use JavaScript to capture the right-click of the mouse, which will keep some people from viewing your source.

See also  Redefining Energy Management: Advanced Solutions for Modern Buildings
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist