Next.js Discord

Discord Forum

difference between "window.open()" and router.push()

Unanswered
Munchkin posted this in #help-forum
Open in Discord
MunchkinOP
As the title says. I am wondering what the difference is between the 2. they do the same so i am wondering if router is maybe better optimalized

2 Replies

MunchkinOP
there is also ofc: window.location.href = "" which does the same thing
@Munchkin As the title says. I am wondering what the difference is between the 2. they do the same so i am wondering if router is maybe better optimalized
router.push is a client-side navigation where navigation takes place by the client-side javascript

window.open() and window.location.href are browser navigation, equivalent to directly hitting the refresh button on the browser