Mitchell Looijer
Mitchell Looijer

Reputation: 5

Redirect from a specific url to another url in JavaScript

I want redirect a user from https://app.salonized.com/c/5304/dashboard (the page after logging in) to this page https://app.salonized.com/franchise/reports/overview using JavaScript. I tried some redirects but I lack the knowledge to get this done properly.

I tried this method but I think I'm doing it wrong:

if
window.location. = "https://app.salonized.com/mobile"
else 
window.location.href = "https://app.salonized.com/franchise/reports/overview"

Upvotes: 0

Views: 42

Answers (1)

Kyle
Kyle

Reputation: 1503

Just need some proper synax.

'=' for setting and use '===' for comparing

if(window.location.href === "https://app.salonized.com/mobile"){
    window.location.href = "https://app.salonized.com/franchise/reports/overview";
}

Upvotes: 1

Related Questions