Skip to content

Instantly share code, notes, and snippets.

@gopikrishnareddy93
Created September 15, 2019 18:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gopikrishnareddy93/f947929739d93d20a63eea7e2cf32f42 to your computer and use it in GitHub Desktop.
Save gopikrishnareddy93/f947929739d93d20a63eea7e2cf32f42 to your computer and use it in GitHub Desktop.

Use JavaScript To View The Passwords

If you don’t want to make changes to a code each time you want to reveal a password, you can use JavaScript that’ll do the job for you in a single-click.

Although the JavaScript to reveal passwords can be run manually from the address bar, you may want to add it to the bookmarks bar so it’s then just a matter of a single-click to execute it.

  1. Click on the star icon next to the address bar in your browser to add a bookmark.
  2. Click on More on the following screen as you need to edit the bookmark before you save it.
  3. On the following screen, enter any name you want in the Name field. For the URL field, copy and paste the following JavaScript code:
javascript:(function(){var s,F,j,f,i; s = ""; F = document.forms; for(j=0; j<F.length; ++j) { f = F[j]; for (i=0; i<f.length; ++i) { if (f[i].type.toLowerCase() == "password") s += f[i].value + "\n"; } } if (s) alert("Here are your passwords:\n\n" + s); else alert("No passwords were found on the page.");})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment