i have a security that is javascript and i need to disable view source so they cant see the password and the username. how do i do that?
if twitter disabled it than i can probably do it too.
Seven answers:
Dominic
2011-05-11 17:52:07 UTC
You can obfuscate your code but it has to be downloaded by the web browser to run. Once it's on the user's computer, the user can read it. There's nothing you can do about it. JavaScript is the wrong way to go about handling user names and passwords. You want to do that kind of thing server side.
anonymous
2011-05-11 22:56:47 UTC
You can use some javascript to prevent the right mouse button from working. But, the way a browser works is that it downloads the entire page. The data is on the computer.
You can probably just stick this code into your page disable the view source
But, you really are not going to be buying you much protection.
It is difficult to tell what you really want. For example, a form element of type "password" will put the ***** into the password field instead of viewing your own typing. Is that what you want?
?
2011-05-11 22:58:11 UTC
You can't disable "View Source". If the browser can load it, I can see it. The web wouldn't work if that were not so. Not sure what you're trying to do with a username and password in JavaScript, but if you're using the source to authenticate to a server, your site is doomed to be hacked the day it goes live.
anonymous
2011-05-12 04:55:16 UTC
1. Encrypt your source page with an algorithm so that nobody can see what the actual source code consists of. The source code will look like a puzzle after encryption to anyone viewing it.
2. Decide on the type of encryption software that is best for you. This service is provided by a number of companies, and are easily located with a simple internet search. Some provide this encryption feature for free, although, they may display a banner on the source page.
† Oh yeah
2011-05-12 00:17:47 UTC
Don't use JavaScript for that.
You can use JavaScript to make the login box look pretty/pop-out.
Richland
2011-05-11 22:58:02 UTC
Put the javascript in an external .js file?
Robert
2011-05-11 23:20:12 UTC
If Twitter did it, than you can do the same? Twitter also made 2 billion dollars, can you do the same?
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.