I want to open a link in the same window and in the same tab that contains the page with the link.When I try to open a link by using `window.open`, then it opens in new tab—not in the same tab in the same window.
Unless I am misunderstanding your question this is the default behavior for any link. However you can make this explicit by adding a target attribute to your a tag. See:
https://www.w3schools.com/tags/att_a_target.asp - for syntax and accepted attribute values
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a - for some warnings on possible performance issues