I've asked this before, but there were no answers so I feel I may have asked the question incorrectly. This is my previous question: Strip all HTML tags besides wanted ones when using preview.html()
I'm now asking the same question but this time for node.js and sockets. I want to allow only certain html tags and block all the the others.
socket.on('refresh feed',function(msg){
$("#chtxt").append(msg + '<br />');
chtxt.scrollTop = chtxt.scrollHeight;
});
This code allows any html tag to come through after it has been passed through sockets.
Ideally, I'd like to prevent all but allowed tags to be passed through.
Server side code:
io.on('connection',function(socket){
//console.log("A user is connected");
socket.on('status added',function(status){
add_status(status,function(res){
if(res){
io.emit('refresh feed',status);
} else {
io.emit('error');
}
});
});
});
via Dshiz
No comments:
Post a Comment