Which property would you use to redirect visitor to another page?

  1. window.location.href

  2. document.href

  3. java.redirect.url

  4. link.redirect.href


Correct Option: A
Explanation:

To redirect a visitor to another page using JavaScript, you can use the window.location.href property. This property sets or returns the entire URL of the current page, including the protocol, host name, path, and the file name of the current page. By assigning a new URL to this property, you can redirect the user to a new page.

Option A is correct: window.location.href

Option B is incorrect because there's no document.href property.

Option C is incorrect because there's no java.redirect.url property.

Option D is incorrect because there's no link.redirect.href property.

Therefore, the correct answer is:

The Answer is: A

Find more quizzes: