var loc_array = document.location.href.split(\'/\'); var linkElement = document.getElementById(\"waBackButton\"); var newT = document.createTextNode(loc_array[loc_array.
Why not just do
unescape(document.location.href);