Question

I'm looking for a javascript version of PHP's html_entity_decode. I found this:

function html_entity_decode(str){
 var tarea=document.createElement('textarea');
 tarea.innerHTML = str; return tarea.value;
 tarea.parentNode.removeChild(tarea);
}

However, I can't use this because I need to write this code for an FBML/FBJS Facebook canvas app, and they have disabled innerHTML and anything similar (insanity, I know).

Is there any other way to do this that doesn't resort to sticking the string into an element and pulling it back out again? Please make sure to only use functions that would be allowed in FBJS

Was it helpful?

Solution

I guess you'll have to do it manually. A quick Google search brought up this library that does what you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top