Opening an url in same window

First create the javascript function:

function selfWindow(){
  window.location.href = 'http://www.navayan.com';
}

then call that function on ‘onclick’ event on button or on anchor link

<input type="button" onclick="selfWindow();" value="open">
<a href="#" onclick="selfWindow();">Open this</a>