How to open a href link via console dev tolls?

Asked

Viewed 44 times

-1

How can I, using the Chrome console (dev tools), open the example link below in the same window as the website:

Example: website: https://musica.cancaonova.com/

link location: Document.querySelector('#menu-item-5972 a'). href

link: https://musica.cancaonova.com/

The command below opens in a new tab, but I need it to be opened in the same tab.

open(document.querySelector('#menu-item-5972 a').href)

1 answer

1

Instead of using window.open tries to use the window.location.href

For example: window.location.href = "url";

  • I got it from the command: location.replace(document.querySelector('#menu-item-5972 a').href)

  • @Nay-ton Good idea, this command also works!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.