Devi usere il comando window.open() invece del comando location

window.open (newlocation,"mywindow");
invece di

location=newlocation