What is the difference between window.location.href and window.open () methods in JavaScript?
What is the difference between window.location.href and window.open () methods in JavaScript?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
window.location.hrefis not a method, it’s a property that will tell you the current URL location of the browser. Changing the value of the property will redirect the page.window.open()is a method that you can pass a URL to that you want to open in a new window. For example:window.location.href example:
window.open() example:
Additional Information:
window.open()can be passed additional parameters. See: window.open tutorial