I want to open url in new tab. I used window.open("url", "_blank").focus()
. I have url for example "localhost:3000/index" and I open url "www.page.com" and it opens new tab with url "localhost:3000/www.page.com". But I want just "www.page.com". In my project I also use BrowserRouter from react-router-dom. Is it the reason why it is not working?
Thanks for any answer
You should use https:// at the beginning of the url if you are directing to a page out of the application.
window.open("https://www.page.com","_blank");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.