How could it work in principle?
You need to do this:
window.location = "http://www.CodeProject.com";
Accordingly, if you want to work with a variable, 1) it should have a valid variable name, 2) it should be assigned a value of a valid literal:
myLocation = "http://www.CodeProject.com";
window.location = myLocation;
—SA