04 February 2016

Bookmarklet for Translating a Named Entity to a Unicode Value

Bookmarklet for Translating a Named Entity to a Unicode Value


In a previous post, we explained how to use Javascript to translate a named HTML entity to a Unicode value.

Here is the corresponding "Bookmarklet":

javascript:x=prompt("entity","");translateNamedEntity=function(a){var b=document.createElement("div");b.innerHTML=a;a=b.childNodes[0].nodeValue;return a.charCodeAt(0).toString(16)};x&&window.alert(translateNamedEntity(x));

To use it, simply create a new bookmark and enter the above code as the URL.

No comments: