Home > OS >  How to redirect to an external url outside the react router dom management
How to redirect to an external url outside the react router dom management

Time:09-02

Hi need to redirect to an external url after a logout made by a specific profile saved in the env profiles of my react application.

example: baseUrl --> www.mywebsite.com, so every link in my router dom continues from the base mywebsite/

The problem is, I need to redirect to lets say, www.google.com, but using useNavigate of react router dom or using basic js like window.location.replace always redirect me to www.mywebsite/google.com when I just want only www.google.com How can I force it?

CodePudding user response:

use window.location.href = "https://www.google.com/" with full url not just "www.google.com" or something other

  • Related