In reading about how to avoid json hijacking I've come across various methods including POSTing everything or prepending responses so they are not valid JavaScript.
The most common way to prepend seems to be to add {} &&
in front of your object or array. Angular suggests prepending with )]}',\n
.
Why does angular not use the more standard {} &&
approach? Is one not totally secure? Is one more difficult to use in JavaScript? Angular aside, is there a good reason for taking the less popular approach?