How to Disable Copy Paste (Browser)

后端 未结 10 724
旧时难觅i
旧时难觅i 2020-11-27 19:36

I am trying 2 alternatives:

  • Ignore right-click
  • Ignore ctrl + C, ctrl + A

This is my code:

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 19:46

    Why not try to make the text unselectable?

    .unselectable {
      -webkit-user-select: none;  /* Chrome all / Safari all */
      -moz-user-select: none;     /* Firefox all */
      -ms-user-select: none;      /* IE 10+ */
      user-select: none;          /* Likely future */       
    }
    
    
    /*Mobile*/
    
    -webkit-touch-callout: default   /* displays the callout */
    -webkit-touch-callout: none      /* disables the callout */
    

    I will also very soon edit this answer. I'm looking at the same issue. But I found some info on how to over write. I'm writing a JS function that when the user has copied the clipboard gets overwritten. Anyway will post that when done. Still experimenting with it. You can read the article that I found on css tricks.

    https://css-tricks.com/copy-paste-the-web/

提交回复
热议问题