Javascript equivalent to html_entity_decode that doesn't rely on innerHTML?

I am looking for a javascript version of PHP 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 the Facebook FBML / FBJS canvas application and they turned off innerHTML and something similar (crazy, I know).

Is there any other way to do this that doesn't resort to inserting a string into an element and pulling it back? Be sure to use only functions that are allowed in FBJS

+3
source share
1 answer

, . Google , , .

+1

Source: https://habr.com/ru/post/1755815/


All Articles