简体   繁体   中英

How to send data from backend to front end securely

So I am trying to find a way to send data from the back end to the front end securely.

My application is about posting images, and each post has a name, id, comments, etc..

The problem is that I want to prerender all my posts using pug, but also send all the data of those posts securely to the front end. I know that you can send data using the dataset attributes, but I don't want a client to see this data - I want it to be secure.

I just want to know if this is even possible, and if there is a secure way to implement this

Eg Server sends data of 50 posts. Those 50 posts can be accessed in a front end js file, but cannot be accessed through the console in inspect element, or any other way.

Once the data hits the browser (eg front-end) it is available to the user. You can see the data in the Network tab of the dev tools in Chrome. I am not to sure what you mean by securing it in the front-end. It seems like you are trying to override browser functionality which is not possible. You can use javascript to a certain extend to stop people from getting the context menu on images etc, however, if a users looks hard enough it is easy to get the data that has been loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM