Tags
Asked 3 years ago
9 Jun 2021
Views 801
Ardith

Ardith posted

window.open vs window.location.href

window.open vs window.location.href
how to use target _self with window.open or window.location.href
Mahesh Radadiya

Mahesh Radadiya
answered Jun 9 '21 00:00

window.open can open new tab or window as per given dimesions


  window.open("www.google.com", "", "width=100,height=100");


window.open is used to create new window or new tab with width 100 and height 100 with url : google.com

and window.location.href is used to redirect to the new page .


window.location.href ="https://www.google.com";

above code will redirect to google.com in same window
Post Answer