I
I
Isaac Clark2015-03-03 16:36:52
JavaScript
Isaac Clark, 2015-03-03 16:36:52

Which htmlEntities are used by Facebook, Google or Twitter?

Hello, tell me please.
I use the following function on my project on the frontend to be safe from using xss

function htmlEntities(str) {
    return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}

This begs the question, do companies like Google or Facebook or other similar monsters really use the usual replace ? Something hard to believe or do they have their own self-written encoders?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2015-03-03
@miraage

Don't make them fly.

P
Philipp, 2015-03-03
@zoonman

Develop!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question