How to make data confidential and readonly?
I am entering comments.
<div class="comment-input" contenteditable></div>
Inside the keydown event, I want to define what type of new comment is? In my example, there are 2 types: New comment and Reply comment.
My idea: add attribute comment-level
to div. For example:
<div class="comment-input" data-comment-level="0" contenteditable></div>
or
$('.sub-comment [contenteditable]').data('comment-level', 1);
If comment-level
- 0
, this is a new comment. Otherwise, he replies to the comment.
Problem: Both can be easily edited on the client side. While clicking F12
to edit an attribute on a tab Elements
or tab Console
, try typing:
// you are hacked
$('.sub-comment [contenteditable]').data('comment-level', 'foo');
My question is, how can I securely install / retrieve data?
source to share
No one has answered this question yet
Check out similar questions: