In my site, there is a div that gets updated dynamically by my system.
Through Ajax, that div contents is retrieved and sent to my server.
This is done through
$("div").find("script").remove();
var data = $("div").html();
////ajax request
How can I prevent users from adding their own HTML via inspect element, I've done so through the script tags but not sure how secure that is.
Note, the custom html must be removed, not converted into html entities or url encoded or something
I don't think there's a 100% secure way, but is there a way to make it difficult at least for users to do so.
If users add custom html through inspect element, it shouldn't be removed. Only when the ajax request is made, any custom html should be removed