I have java script function to check the URL and split it, I ask a question and depends on the answer it will forward the user page all works fine until I use window.location.assign(); with string inside (=window.location.assign(path);) instead of fixed URL (=window.location.assign("http://stackoverflow.com");) what can i do? thanks...
var register=...;
var login=...;
function link(type) {
var urlPath = document.URL.split("/");
if (type == "register") {
var path= urlPath[2] + register;
window.location.assign(path);
}
else {
var path = urlPath[2] + login;
window.location.assign(path);
}
event.preventDefault();
}
You should use the full URL.
Or