HTML How do I open this URL in a new window?
you can use to open after next tab onclickevent: window.open('url','_blank')
<a href="https://google.com" onclick="window.open('https://youtube.com','_blank'); return false;">click here for a new tab</a>
or you can use to open a new window: window.open('url','','width=,height=')
<a href="https://google.com" onclick="window.open('https://youtube.com','','width=800,height=700'); return false;">click here for a new window...</a>
In this example, it will open youtube ( REAL_URL
) instead of google ( FAKE_URL
)
Explanation:
Your mistake was that the addition changes the behavior of yours , but not yours . So without it it will open in a new tab. target="_blank"
<a href="..."></a>
document.location.href='...'
document.location.href='...'
FAKE_URL
source to share