Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript - Replace '%20' spaces

var loc_array = document.location.href.split('/');
var linkElement = document.getElementById("waBackButton");
var newT = document.createTextNode(loc_array[loc_array.length-2]); 
var repl = newT.replace('%20',' ');
linkElement.appendChild(repl);

Anyone know why this causes the text to not show up?

like image 389
balexander Avatar asked Jan 24 '26 21:01

balexander


1 Answers

Why not just do

unescape(document.location.href);
like image 63
Robusto Avatar answered Jan 27 '26 10:01

Robusto